Add external link to Featured image
-
Picking up where the Featured Image post left off – I’d like to be able to actually link the image to a separate url than the post itself.
I’ve created a custom field for the blog post called url and I have this code in the post_loop_template.php page:
<div class="featured-image"> <?php $url = get_post_meta($post->ID, 'url', true);?> <a href="<?php echo $url ?>" title="<?php the_title(); ?>"> <?php the_post_thumbnail('thumbnail'); ?> </a> </div>But the url is not populating. There’s nothing in the a href=””
What am I missing?
Thank you!
The topic ‘Add external link to Featured image’ is closed to new replies.