最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Embed ACF URL Field in WP title field

programmeradmin1浏览0评论

I have a small listing-type block on a website that displays editorial titles which when clicked I want a new browser to open and the resulting page display the external page related to the clicked title in a new browser window.

I created a ACF field called title_link and this was working. However, I have just stripped back the Custom Fields to make the UX more intuitive. It broke, I have played with the code, I know it’s simple but I have gone blank as to why.

<a href=<<? php get_field( 'title_link', $this->post->ID );?> target="_blank"><?php echo get_the_title( $this->post->ID );?></a>

All and any help received gratefully.

G

I have a small listing-type block on a website that displays editorial titles which when clicked I want a new browser to open and the resulting page display the external page related to the clicked title in a new browser window.

I created a ACF field called title_link and this was working. However, I have just stripped back the Custom Fields to make the UX more intuitive. It broke, I have played with the code, I know it’s simple but I have gone blank as to why.

<a href=<<? php get_field( 'title_link', $this->post->ID );?> target="_blank"><?php echo get_the_title( $this->post->ID );?></a>

All and any help received gratefully.

G

Share Improve this question asked Jul 25, 2019 at 22:24 Gary JonesGary Jones 1 1
  • Is that <<? php just a typo in the question? And the href value needs to be in quotes - href="value". – Sally CJ Commented Jul 25, 2019 at 22:49
Add a comment  | 

1 Answer 1

Reset to default 0

Have solved it.

       <div><a target="_blank" href="<?php the_field('title_link', $this->post->ID); ?>" rel="bookmark" title="<?php echo get_the_title( $this->post->ID );//$title; ?>"><?php echo get_the_title( $this->post->ID ); //$title; ?></a>   </div>            
发布评论

评论列表(0)

  1. 暂无评论