Support » Plugins » Displaying “Related Tags” How to? Is there any plugins?

  • I want to display “Related Tags” on my article based on the tags I used for the article. Is there any plugins for this? I search but couldn’t find any.

    I know there are alot of plugins to display “Related Posts”.


Viewing 1 replies (of 1 total)
  • Wp Recipes has a cod snippit that shows related post via tag. The original code on the page has an issue that it does close the wp_query and it will mess up your comments, if they fall after.

    The original code can be found here:

    Below is my modified version that fixes that wp_query problem using wp_reset_query();

      //for use in the loop, list 5 post titles related to first tag on current post
      $tags = wp_get_post_tags($post->ID);
      if ($tags) {
        $first_tag = $tags[0]->term_id;
          'tag__in' => array($first_tag),
          'post__not_in' => array($post->ID),
            $my_query = new WP_Query($args);
            if( $my_query->have_posts() ) {
                echo '<div class="hr_bottom"></div><div id="relatedContent"><ul><h2>Related Posts</h2>';
              while ($my_query->have_posts()) : $my_query->the_post(); ?>
                <li><span class="title"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></span> <span class="meta"> - <?php the_time('l, F j, Y G:i'); ?> - <a href="<?php the_permalink() ?>#commenting" title="Jump to the comments"><?php comments_number('0 Comments','1 Comment','% Comments'); ?></a></span></li>
      echo '</ul></div>';
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying “Related Tags” How to? Is there any plugins?’ is closed to new replies.