Skip to content

WordPress Related Posts

In my quest to add functionality to Fanmode, I added a WordPress plugin that adds links to related posts for each entry.
WordPress Related Posts
Plugins that add this feature have been around for quite some time but the one I’m using leverages WordPress tagging features which were included in version 2.3. If you’ve updated to the latest version of WordPress, you would have noticed you can now add tags to each post in addition to categories. This should make it easier for readers to find related content on your site.

The plugin I’m relying on is called WP 2.3 Related Posts and was written by Denis Hua. As of writing, the latest version is 0.4.

There’s a readme.txt with installation instructions but I preferred the instructions on the plugin page. The readme.txt file instructs users to upload the entire directory of unzipped files but that may not be necessary. That directory contains 15 files but I only needed wp23_related_posts.php. The other files were translations to other languages. I don’t envision any great personal need for, say, a Bulgarian-translation of the plugin on my site so I just uploaded one file to the WordPress plugins directory.

Once I did that, I activated the plugin in WordPress’s admin section and then configured it. The main options include the title text (e.g. “Related”), the text to display in case there weren’t any related posts and the number of related posts to display. The plugin also has options to exclude some categories from being displayed, enable the related posts feature for RSS feeds, display the number of comments for each related post and display the posting date of each related post.

Once you’ve set your preferences, you need to call the plugin function by editing a file in your WordPress themes directory. This would be the file that displays a single post entry and depending on your theme, this will usually be single.php or index.php. In my case, I was using the Vertigo theme so I had to edit index.php to include the following line:
WordPress Related Posts php code

Once I made that change, the related posts showed up if there were related entries for a particular post. Note that this feature works best if you’ve been diligently adding tags to your entry.

Posted in Blogging, WordPress.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.