Support » Fixing WordPress » Want to add related link & image to bottom of posts by Tag…
5 years, 8 months ago
I want WP to automatically add an image and then a link to the single.php based on the Tag or Tags in the post. Can this be accomplished?
This is similar to a Related Posts feature, but I want to try and link to a specific page (with an image to the left of the link) each time.
It should be possible using get_the_tags. Something like:
$posttags = get_the_tags();
if ($posttags && in_array( 'wibble',$posttags) ) :>
[ output image & link ]
should work within the Loop.
How do I specify which tag and which image to pull in?
Replace wibble with the tag that you want to use. As for which image to use – that’s up to you.