WordPress.org

Ready to get started?Download WordPress

Plugin Directory

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 post a comment at the WordPress.org support forum. I monitor the forums on an ongoing basis. If you're looking for more advanced support, please see details here.

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. In a future version, I will be adding in CSS support within the plugins Settings page.

The following CSS classes / IDs are available:

  • 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

For more information, please visit http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/

How does the plugin select thumbnails?

The plugin selects thumbnails in the following order:

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

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

  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

The plugin uses timthumb to generate thumbnails by default. Depending on the configuration of your webhost you might run into certain problems. Please check out the timthumb troubleshooting page regarding permission settings for the folder and files.

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_ald_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_ald_crp')) echo_ald_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

Filters

The plugin includes the following filters that allows you to customise the output for several section using add_filter.

crp_heading_title : Filter for heading title of the posts. This is the text that you enter under Output options > Title of related posts

crp_title : Filter for the post title for each of the related posts

I'll be adding more filters eventually. If you are looking for any particular filter do raise a post in the support forum requesting the same.

Requires: 3.0 or higher
Compatible up to: 4.0
Last Updated: 2014-5-10
Downloads: 385,262

Ratings

4 stars
4.4 out of 5 stars

Support

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

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
1 person says 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,5,5
0,1,0