How to add Related Posts to WordPress

The following tutorial illustrates how to add Related Post entries to your WordPress blog. This is done in conjunction with the Ultimate Tag Warrior plugin. If you aren't already using Ultimate tag warrior, I highly recommend adding it to your plugin list. There are so many awesome advanced features this plugin has to offer other than just displaying plain keyword tags. Anyhow, on with how to add Keyword Related Posts to your WordPress entries.

Adding Keyword Related Posts to WordPress entries:

This tutorial assumes that you already have Ultimate Tag Warrior installed and have Keywords in use. If not, please Download, install, and activate the "Ultimate Tag Warrior fin" plugin.

  1. From your WordPress administration panel, navigate to Design -> Theme Editor then locate and select Single Post (single.php) from the theme list.
  2. On it's own line, just before the following code:
  3. <?php comments_template(); ?>

  4. Add:
  5. <div class="utwrelatedposts">
    <h4>Related Posts</h4>
    <?php UTW_ShowRelatedPostsForCurrentPost("posthtmllist", "", "4"); ?>
    </div>

    The number 4 within the code determines how many related posts are displayed.

  6. Click Update File and go view your site.

The relevant Keywords you have tagged for each post, determines which posts display as related to the current post. You can optionally create a utwrelatedposts class entry in your style.css to further customize the styling of the related posts.