WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Efficient Related Posts

A related posts plugin that works quickly even with thousands of posts and tags. Can be added automatically to the end of posts.

How can I add a list of related posts to my posts?

You can configure Efficient Related Posts to add related posts automatically in Settings -> Related Posts. Alternatively you can use the shortcode [relatedPosts] or the you can use the 'erp-show-related-posts' action or 'erp-get-related-posts' filter in your theme files.

How exactly do you use the [[relatedPosts]] shortcode?

To use the default settings (from Settings -> Related Posts) you just need to add [relatedPosts] to your post or page where you want to list to be. You can also add some attributes to it such as num_to_display (Number of related posts to display), no_rp_text (Text to display if there are no related posts), and title (Title for related posts list, empty for none) like this:

  • [relatedPosts title="Most Related Post" num_to_display="1"]
  • [relatedPosts num_to_display="1" no_rp_text="No Related Posts Found"]
  • [relatedPosts title="Try these related posts:" num_to_display="3" no_rp_text="No Related Posts Found"]

How do I add this to my theme?

You can use the 'erp-show-related-posts' action or 'erp-get-related-posts' filter to display a list of related posts in your theme. They need to be used in "the loop" and the only difference is that the 'erp-get-related-posts' filter returns the list and the 'erp-show-related-posts' action echos the list. You can also pass an associative array of arguments to it such as num_to_display (Number of related posts to display), no_rp_text (Text to display if there are no related posts), and title (Title for related posts list, empty for none) like this:

  • <?php do_action('erp-show-related-posts', array('title'=>'Most Related Post', 'num_to_display'=>1)); ?>
  • <?php echo apply_filters('erp-get-related-posts', array('num_to_display'=>1, 'no_rp_text'=>'No Related Posts Found')); ?>
  • <?php do_action('erp-show-related-posts', array('title'=>'Most Related Posts', 'num_to_display'=>3, 'no_rp_text'=>'No Related Posts Found')); ?>

How do the theme helper functions work?

The theme helper functions still exist, but the new actions and filters mentioned above are preferred. Hopefully the helper functions will be removed in the future, so PLEASE don't use them.

If it calculates related posts when a post is saved, won't a post only be related to older posts?

No, Efficient Related Posts finds all the posts related to the one being saved, and if the current post is more closely related to one of those posts than the least related post that is currently stored, it re-processes that post. Simple right? Well, maybe it's not so simple, but rest assured that your posts can and will show the posts they are most related to regardless of post date.

What metrics are used?

Posts are considered related based on tags. This may be extended in the future, but I wanted to keep the queries as clean as possible.

Requires: 2.8 or higher
Compatible up to: 3.7.1
Last Updated: 2013-9-17
Downloads: 103,437

Ratings

4 stars
4 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,2,2 80,5,4 100,1,1
90,10,9
80,10,8 100,1,1
100,3,3 67,6,4
73,11,8
100,1,1
50,4,2
83,6,5 100,1,1
56,9,5 86,7,6
100,2,2
100,5,5
100,3,3
100,2,2
82,17,14
67,3,2
36,11,4
50,4,2
33,3,1
33,3,1
100,1,1
0,4,0 100,1,1
0,3,0 100,2,2
100,1,1
100,2,2
0,1,0