Simply Related Posts, a WordPress Widget Plugin to relate Posts by taxonomy the easy wayJanuary 15, 2013 The code provided in this article, is available on github.
I know, there are a lot of widgets out there, to print related posts, but none of them I tested really suited my needs. First of all I think a widget shouldn’t have a whole bunch of global settings, rather no global settings at all, I mean, it’s just a widget. But, even if I don’t like a huge settings page, just to run a little widget, there has to be some flexibility to let me adjust every widget-instance to my needs.
The Simply Related Posts Widget
In the case of related posts I couldn’t find a widget that really did what I wanted so I build my own. There are no global settings, but every widget instance has four options:
- The title of the widget (default: Related Posts). It is similar to all other widget titles and gets printed before the widget-content.
- The taxonomy by which terms the posts are related (default: Tags). A post is related to another post, as soon it they share one or more terms of a taxonomy. This can be the standard taxonomies Tags and Categories, or Custom taxonomies. Here youchoose which taxonomy is the relating one.
- How many related posts to show (default 5). Quite simple, put the maximal number of related posts you want to be visible here.
- Terms to exclude (default: none). Sometimes there are terms in a taxonomy, which are related to almost every post. The tag wordpress in my blog is such an example. If you have such tags you should exclude them, because they relate basically all posts, which would make the widget quite useless
- Download the plugin from the directory: Simply Related Posts
- Unpack and upload the
simply-related-postsfolder to the
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Go to the ‘Apearance/Widgets’ area, add the ‘Simply Related Posts’ widget to a widget area.
- Make your settings
For now the code is available via svn from the plugin directory:
Now, there is even a github repository: