Efficient Related Posts 0.3.2 Released

Version 0.3.2 of Efficient Related Posts was just released. Due to popular demand, it now has a shortcode to add add the list of posts anywhere shortcodes are supported in the loop. The readme was also updated to answer some of the common usage questions and to explain how to use the new shortcode.

The best place to find information is on the Efficient Related Posts page which is updated regularly. However, here are some of the new FAQs.

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 helper functions wp_get_related_posts() and wp_related_posts() 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 the theme helper functions work?

You can use wp_get_related_posts() and wp_related_posts() to display a list of related posts in your theme. They need to be used in “the loop” and the only difference is that wp_get_related_posts() returns the list and wp_related_posts() 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:

  • wp_related_posts(array('title'=>'Most Related Post', 'num_to_display'=>1))
  • echo wp_get_related_posts(array('num_to_display'=>1, 'no_rp_text'=>'No Related Posts Found'))
  • wp_related_posts(array('title'=>'Most Related Post', 'num_to_display'=>3, 'no_rp_text'=>'No Related Posts Found'))

About Aaron D. Campbell

Owner and lead developer at BlueDog, Aaron has 10+ years of web development experience, it a regular core contributor to the WordPress project, and has released many WordPress plugins.
This entry was posted in WordPress Plugin Updates and tagged , , , . Bookmark the permalink.