• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • It should be possible using get_the_tags. Something like:

    <?php
    $posttags = get_the_tags();
    if ($posttags && in_array( 'wibble',$posttags) ) :>
    [ output image & link ]
    endif;?>

    should work within the Loop.

    Thread Starter kk4uga

    (@kk4uga)

    Thanks.

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Want to add related link & image to bottom of posts by Tag…’ is closed to new replies.