I am going by this tutorial (https://redvinestudio.com/how-to-build-isotope-portfolio-in-your-wordpress-theme/), and when I am working on the part where the portfolio items are displayed as links, the url that the link leads to is being displayed above the item. Below is the prescribed code:
echo '<div class="all portfolio-item '. $tax .'">';
echo '<a href="'. the_permalink() .'" title="'. the_title_attribute() .'">';
echo '<div class="thumbnail">'. the_post_thumbnail('thumbnail') .'</div>';
echo '<h2>'. the_title() .'</h2>';
echo '</a>';
/*echo '<div>'. the_excerpt() .'</div>';*/
echo '</div>';
You can’t use
the_permalink()
within anecho
, because itecho
es data itself. Instead, you need to use get_permalink(). You also need to modifythe_title_attribute()
to avoid a duplicatedecho
there:EDIT: You need to comb through your code to remove all instances of code that is echoing content within an
echo
. This includesthe_title()
,the_post_thumbnail()
, etc.the_permalink() will always echo the URL of the object, which means you’re telling it to echo twice. Change it to get_permalink() and it should work.