Installing, Using, and Styling the Related Posts Plugin

Add a Comment

One of the best and most widely used WordPress Plugins on blogs is the Related Posts Plugin. I can think of plenty of big name sites that use some rendition of it, if not this very plugin (Daily Blog Tips and Problogger, for example). But even more than using this plugin is using it well. This is both a conceptual and a stylistic issue, and hopefully I can help with both. First of all, you’re going to want to download the plugin and get it installed.

Installing the Related Posts Plugin

  1. Visit the author’s page and download the most up to date version. You have to scroll down a little, but it’s there.
  2. Upload to your plugin folder and activate the plugin on your WordPress Dashboard.
  3. The place to change settings for this plugin is not under Options. It’s under Plugins > Related Posts Options. Weird, but that’s how it works. Go there.
  4. Obviously you can set up the plugin to work however you wish. But to fit in with this tutorial, set up your plugin just as I have in the following image.
  5. Hit Save! and then click this script at the bottom to finalize the setup process.

Now you’re all good to go. But unless we keep going, you won’t have anything on your blog. So let’s get the plugin working for you and style it so it looks as good (hopefully) as the rest of your blog. I’m going to discuss a couple of the conceptual aspects of using this plugin (and how best to use it) but if that doesn’t interest you feel free to skip down to the tutorial.

How Many Posts is Too Many?

There are many resources out to discuss the pros/cons of more posts vs. less posts, etc. Actually, most recently Daniel of Daily Blog Tips switched his front page post display style. That raised some eyebrows, but the discussion was still a pretty even divide. In this scenario we have the ability to show your readers other posts that they may be interested in, assuming they enjoyed what they just read. The first stop, obviously, is to create solid content that people would want to read. That’s the first challenge. The second challenge is not to give them so many related options that they don’t even bother with the list but give them enough that one of the links catches their attention. Anyone will tell you, this can be a tough balance. In my experience three is the lowest number I would go to, and five is the highest. Anything below is no good (what’s the point) and anything above gets to be too much. Find your balance, and go with it. But be sure that you are taking your blog’s niche into consideration, and what your audience would be interested in (or, conversely, what they can handle!).

Where to Post Related Posts

I would say that the only place related posts are even remotely welcome is on the single post view of WordPress. Anywhere else and it just becomes offensive. For example:

  • On the homepage: Too busy. Even if you use more to post only snippets, you’re lengthening the amount of time it takes to scroll down your page. Bad idea.
  • On archive pages: Same answer as above.
  • On search pages: Seems a bit redundant, doesn’t it?

I could go on, but I hope you get the point. So the following tutorial is going to instruct you to put the call for the plugin on the single post pages only, and now you know why.

Using and Styling the Related Posts Plugin

  1. First, be sure you have the settings for your plugin set up the same way I do, in step four above.
  2. Now we’re going to want to actually place the plugin on a page. As explained above, we want to put this on the single posts page for the sake of your reader’s sanity. Pull open your single post template under Presentation > Theme Editor.
  3. Find the following code in your page:
    <p class="postmetadata alt">
  4. Right above that paragraph, drop in the following code:
    <?php related_posts(); ?>
  5. But that isn’t enough. We want the list items to actually be contained in a list, so surround that call with the following code, like this:
    <ul><?php related_posts(); ?></ul>
  6. And include some sort of header for the post. I like to bold the reference, just above it. Anything like “Related Posts” or “Read more posts like this” will work fine.
  7. Hit save and there you have it!
  8. But we’re still not done. We want to be sure it is styled correctly.
  9. To make your list/paragraph turn out the way ours do here at Theme Playground, use the following code for your lists and paragraph:
    p { font-size: 1.2em; line-height: 1.8em; margin-bottom: 1.8em; } ol, ul { font-size: 1.2em; line-height: 1.8em; margin: 1.8em 0 1.8em 3em; }
  10. And you should end up with a listing at the end of your posts that looks something like this.

    Related Posts at Theme Playground

Thanks for reading and be sure to ask any questions that you have about the tutorial here, and send any plugin questions over to the author’s homepage.