WordPress.org

Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Contextual Related Posts

Display related posts on your WordPress blog and feed. Supports thumbnails, shortcodes, widgets and custom post types!

If your question isn't listed here, please create a new post at the WordPress.org support forum. It is the fastest way to get support as I monitor the forums regularly. I also provide premium paid support via email.

How can I customise the output?

Several customization options are available via the Settings page in WordPress Admin. You can access this via Settings » Related Posts

The plugin also provides you with a set of CSS classes that allow you to style your posts by adding code to the style.css sheet.

The main CSS classes / IDs are:

  • crp_related: ID of the main wrapper div. This is only displayed on singular pages, i.e. post, page and attachment

  • crp_related: Class of the main wrapper div. If you are displaying the related posts on non-singular pages, then you should style this

  • crp_title: Class of the span tag for title of the post

  • crp_excerpt: Class of the span tag for excerpt (if included)

  • crp_thumb: Class of the post thumbnail img tag

How does the plugin select thumbnails?

The plugin selects thumbnails in the following order:

  1. Post meta field: This is the meta field value you can use when editing your post. The default is post-image

  2. Post Thumbnail image: The image that you can set while editing your post in WordPress » New Post screen

  3. First image in the post: The plugin will try to fetch the first image in the post

  4. Video Thumbnails: Meta field set by Video Thumbnails

  5. Default Thumbnail: If enabled, it will use the default thumbnail that you specify in the Settings screen

Manual install

The following functions are available in case you wish to do a manual install of the posts by editing the theme files.

echo_crp( $args = array() )

Echoes the list of posts wherever you add the this function. You can also use this function to display related posts on any type of page generated by WordPress including homepage and archive pages.

Usage: <?php if ( function_exists( 'echo_crp' ) ) { echo_crp(); } ?> to your template file where you want the related posts to be displayed.

get_crp_posts_id()

Takes a post ID and returns the related post IDs as an object.

Usage: <?php if ( function_exists( 'get_crp_posts_id' ) ) { get_crp_posts_id( array( 'postid' => $postid, 'limit' => $limit ) ); } ?>

Parameters:

$postid : The ID of the post you'd like to fetch. By default the current post is fetched. Use within the Loop for best results.

$limit : Maximum number of posts to return. The actual number displayed may be lower depending on the matching algorithm and the category / post exclusion settings.

Shortcodes

You can insert the related posts anywhere in your post using the [crp] shortcode. The plugin takes three optional attributes limit, heading and cache as follows:

[crp limit="5" heading="1" cache="1"]

limit : Maximum number of posts to return. The actual number displayed may be lower depending on the matching algorithm and the category / post exclusion settings.

heading : By default, the heading you specify in Title of related posts: under Output options will be displayed. You can override this by specifying your own heading e.g.

<h3>Similar posts</h3>
[crp limit="2" heading="0"]

cache : Cache the output or not? By default the output will be cached for the post you add the shortcode in. You can override this by specifying cache=0

In addition to the above, the shortcode takes every option that the plugin supports. See crp_default_options() function to see the options that can be set.

Requires: 4.1 or higher
Compatible up to: 4.7
Last Updated: 2 months ago
Active Installs: 60,000+

Ratings

4.8 out of 5 stars

Support

6 of 17 support threads in the last two months have been marked resolved.

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,1,1
100,1,1 100,1,1
100,1,1 100,2,2
100,2,2 100,1,1 100,3,3 100,1,1
100,5,5
83,6,5
67,9,6
100,1,1
100,1,1
100,1,1
100,2,2
100,1,1 50,2,1 50,2,1
100,4,4
100,5,5 100,1,1 100,3,3 100,2,2 50,6,3 0,1,0 0,1,0 0,1,0
75,4,3 100,2,2 100,5,5 50,2,1 100,2,2 100,2,2
100,1,1 100,3,3
100,1,1 100,11,11 100,1,1
75,4,3 100,1,1
100,1,1 100,2,2 75,4,3
50,2,1 100,2,2 100,1,1 100,3,3
100,4,4
100,2,2 100,1,1 100,2,2
100,1,1
100,1,1 100,1,1
100,1,1 100,1,1 100,2,2 100,1,1
100,3,3
100,2,2 100,1,1 100,1,1
100,1,1
100,6,6
0,1,0
100,1,1
100,3,3
100,2,2
100,2,2 100,1,1
100,1,1
100,1,1
100,4,4
100,1,1 100,2,2
100,1,1 100,3,3
100,1,1
50,2,1