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 |1 Answer
Reset to default 0Have 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>
<<? php
just a typo in the question? And thehref
value needs to be in quotes -href="value"
. – Sally CJ Commented Jul 25, 2019 at 22:49