This WordPress plugin lets you manually select related posts using a nifty AJAX powered search utility. A powerful tool for boosting pages per visit and SEO.
Current stable version: 3.0.1
- Easily find entries that might be related to the one you are writing with an integrated AJAX powered search utility,
- Easily add and remove relations with a single click. No page reloads, no pop-ups
- Support for custom post types
- Automatically display a list of related posts underneath your posts content. No need to add any PHP tags in your template files, but several functions available for advanced users.
- Display related posts in multiple widgets
- Use the [ related-posts ] shortcode to display related posts anywhere in your posts content
- The relationship created works reciprocal, which means that if post A is added as related to post B, post B is automatically added as related to post A as well (this option can be turned off easily through the settings panel)
- Widget support
- Flexible customization of the way the related posts are displayed
- Download the plugin and unzip,
- Put the related-posts folder in your wp-content/plugins folder,
- Activate the plugin through the WordPress admin,
- Related posts will be placed underneath your posts/pages content automatically (after you have selected them manually in the write/edit post screen). You can change this and some other settings through the plugins options page under Settings > Related Posts.
- For advanced implementation, there are a couple of API functions available.
There are several options for customizing the way related posts are displayed on the plugins settings page.
For customizing with CSS: the list will be displayed as a
<ul> within a container
<div class="related-posts" id="related-posts-(posttype)">
[ related-posts ]
(without the spaces)
This allows you to display the related posts within the text of your post or page. Simply add the shortcode [ related-posts ] (withouth the spaces) in the content of your post or page and this shortcode will automagically be replaced by the list of related posts.
You can optionally add a “posttype” attribute to the shortcode to display only the related posts of a particular post type:
[ related-posts posttype=page ]
(withouth the spaces)
Place this code in your template files (probably single.php) where you want the list of related posts to be displayed:
To get the output HTML without displaying it use this function:
$related_posts_html = MRP_get_related_posts_html( $post_id )
If you’re looking for further integration; this function will return the IDs and titles of related posts:
$related_posts = MRP_get_related_posts( $post_id );
It will return an array like
For even further customization, you can optionally use the MRP_get_related_posts function to grab a list of related posts as an object, or tell it to include unpublished posts. Here’s how you do it.
The function has 4 parameters:
MRP_get_related_posts( $post_id, $return_object, $hide_unpublished, $post_type )
The default value of this parameter is false. Setting it to true will have the function return the list of related posts as an object, containing all the posts properties, such as post_status, post_author, etc. This allows you to add any other customization before displaying the posts.
$my_related_posts = MRP_get_related_posts( $post->ID, true );
The default value of this parameter is true. Setting it to false will include unpublished posts such as drafts and posts planned in the future in the list returned by the function.
$my_related_posts = MRP_get_related_posts( $post->ID, false, true );
The default value of this parameter is null. You can set this to the name of a post type to get only the related posts for the specified post type(s). You can either declare this parameter as a string for a single post type, or an array for a lists of multiple.
$my_related_posts = MRP_get_related_posts( $post->ID, false, true, 'page' );
$my_related_posts = MRP_get_related_posts( $post->ID, false, true, array( 'page', 'post', 'custom_post_type_1', 'custom_post_type_2' ) );
- Added support for WP 3.0 custom post types – Create relations with custom post types, display related posts in one list or seperate them by post type
- Added controlled order – You can now order the related posts by date, title or random
- Added internationalization – You can now create display the plugin settings page in your own language. I have already added Dutch, please send your language files to email@example.com
- Fixed support for non Western Latin characters (Cyrillic, Arabic, etc.)
- Plus a zillion small bugfixes and enhancements!
- Improved the AJAX search utility with a more fluent way of updating the results list
- Added support for multiple instances of the widget by using the new Widget API introduced in WordPress 2.8
- Fixed a bug where the widget wouldn’t show on pages
- Related private posts are now displayed to users who have the necessary priviliges
- You can now add drafts and planned posts as related posts, without them appearing on your site before they are properly published.
- Added shortcode support: you can now place the [ related-posts ] shortcode within the content of your post to display the related posts anywhere you want.
- (For advanced users) Added a parameter to the MRP_get_related_posts function to optionally get the related posts in an object, so you can easily use it in other plugins or your own custom way of displaying the list of related posts. For documentation on this, see [the API section](http://www.microkid.net/wordpress/related-posts/#API “Microkids Related Posts API functions”).
- (For advanced users) Added a parameter to the MRP_get_related_posts function to optionally include unpublished posts to the related posts list. For documentation on this, see [the API section](http://www.microkid.net/wordpress/related-posts/#API “Microkids Related Posts API functions”).
- Added option to manage search scope: post content, post title, or both
- Slightly improved the search query when searching for related posts
- Added a limit of 50 search results to help the plugin work smoothly on larger sites.
- Fixed some IE6 layout issues
- Fixed issue where, in non reciprocal mode, after editing a post it would lose its passive connections to other posts
- Fixed issue where hitting the enter key while in the search box would submit the page
- Fixed issue where hitting a none character key (like shift, ctrl, etc.) in the search box would trigger the AJAX search
- Added optimized SQL for related posts query provided by Peter Raganitsch
- Added option for turning reciprocal function off provided by Brock Boland
- Fixed some layout issues in WordPress 2.7
- The search tool now searches in post title and post content.
- Solved an issue with shorthand PHP tags.
- Solved an issue where in WP 2.6 relationships with revisions were created when editing a post.
- Added the option to display related posts underneath your post content automatically
- Added the extended customization options for the way the list of related posts is displayed:
- Using a custom title
- Choosing the HTML header element (h1, h2, etc.) of the title for the related posts section
- Custom message to display when there are no related posts, with the option no displaying anything at all (no text, no code)
- Added widget support
- Added support for adding related pages
- Fixed a small issue with the paths to the .js and .css files which made the plugin break on blogs that reside in subdirectories.
A big thank you goes out to:
- Peter Raganitsch for sharing his ancient SQL kung fu and thoroughly improving the speed and accuracy of this plugin.
- Brock Boland for sharing his amazing improvements on the reciprocal function.
- Michael Girouard for sharing his work on support for custom post types
Has this plugin saved your day? Are you using it for a commercial project? Cool! But please consider a donation for my work. I am a professional just like you, so putting work in this plugin means missing money somewhere else!
- Related Posts version 2.4 released (Wordpress)
- Microkids Related Posts version 2.3 released (Wordpress)
- Making Microkids Related Posts work with qTranslate (Wordpress)
- Wordpress Plugin: Author Slug (Wordpress)
- Related Posts for WordPress version 4.0 (Wordpress)
- Wordpress Plugin: Improved Meta Description Snippets (Wordpress)
- Microkids Related Posts version 3.0.1 (Wordpress)
- Wordpress plugin: Permalinks Moved Permanently (Wordpress)
- Testers needed for Microkids Related Posts WordPress plugin (Concepts)
- Microkids Related Posts version 3.0 (Wordpress)
- Related Posts version 2.0 released (Wordpress)
- Related posts version 2.5 released (Wordpress)
- Dutch translation Register Plus Wordpress Plugin (Wordpress)