Support » Plugin: Similar Posts - Best Related Posts Plugin for WordPress » [Plugin: Similar Posts] not showing any posts

  • Resolved deepbevel

    (@deepbevel)


    I’ve configured the plugin to show posts with the same tag, category and author. but it says “none found” even though all posts in a single category have the same tag, and same author. They are private posts so I set it accordingly. I’m using the widget. Is there something else I have to do? does it not work in an archive? Although it doesn’t return any results an post single either.

    http://wordpress.org/extend/plugins/similar-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Gadgetgod

    (@gadgetgod)

    Hi Deepbevel, try installing the “Post-Plugin Library” plugin aswell and let me know if it works 🙂

    Thanks,
    -GG

    Thread Starter deepbevel

    (@deepbevel)

    I did install that first, as instructed. It just wouldn’t show any results. However I found code that gives me exactly what I was looking for:

    <?php
    //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) {
      echo 'Related Posts';
      $first_tag = $tags[0]->term_id;
      $args=array(
        'tag__in' => array($first_tag),
        'post__not_in' => array($post->ID),
        'showposts'=>5,
        'caller_get_posts'=>1
       );
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) {
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
          <?php
        endwhile;
      }
    }
    ?>

    It’s odd though, I tried about 7 plugins which are supposed to return posts of the current tag, none worked. Why this code can do it I’ll probably never know.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Similar Posts] not showing any posts’ is closed to new replies.