How to reposition Jetpack’s new Related Posts module – and a bunch of other handy customizations!

WordPress Deals

With over 3,000,000 downloads, ‘Yet Another Related Posts Plugin‘ (commonly referred to as YARPP), has to be about the most popular Related Posts Plugin for WordPress – and until quite recently, I was quite a fan. However, after switching this site from a VPS to a specific managed WordPress hosting plan, I soon discovered something less-than-perfect about it, namely: it increases database load on large sites so much that Media Temple (the hosts we’re now using) have included it in their list of plugins prohibited from use with said hosting (link to list)! Hmmm, so that’s obviously out of the equation then… So what to use instead? Well, after going through heaps of alternatives (more on this in an upcoming post), I’ve settled on using Jetpack’s new ‘Related Posts’ module – which, so far, seems pretty darn awesome! …All except for one rather big problem: I couldn’t initially get the thing to display where I wanted it!

The problem:

Upon activation, rather than displaying where I wanted it (directly above the comments section), the Jetpack-produced ‘Related Posts’ section was showing up above both the social buttons and author sections… as shown:

Before the move - Screenshot

(click to enlarge)

…a quick look at the relevant options displayed in the Dashboard, under ‘Settings’ → ‘Reading’ → ‘Related Posts’, and disappointment began to set in: since the only two choices displayed appeared to be ‘Show a Related header’ and ‘Use a large and visually striking layout’.

My first thoughts were to find the relevant theme template and move a few lines of code about, however, after realizing this particular Jetpack module was hooking itself to something entirely un-moveable I began to feel like the rest of my day (well, the next few hours maybe) would now probably have to be spent hacking Jetpack…

The workaround:

As it turns out, there’s more to Jetpack than I first thought: not only is it an incredibly handy plugin full of pretty-darn-neat functionality, it’s also extremely well documented – with various support pages on customizing different modules: one of which just so happens to be dedicated to Customizing The Related Posts Module. Looking to change the number of related posts displayed under your posts? Maybe you’d like to change the “Related” headline at the top of the Related Posts section? Or perhaps you fancy replacing one of the Related Posts by a custom result for a specific post? Seriously: who knew*?!

In our case, since we’re looking to move the module to a specific place that isn’t listed in the above-mentioned set of standard customizations, the best bet (well, the simplest at least) is probably to first remove it from from the bottom of our posts by inserting the following code into the functions.php file, like so:

insert-as-shortcode-img-2

…and then re-insert it as a shortcode exactly where we’d like it in the relevant template file (in this case the single.php file), like so:

insert-as-shortcode-img-1

…the result? Scroll down and check it out live!

*Note to any Jetpack developers reading this: why so few options displayed on the settings page? Maybe add a few more?!

**Credit where it’s due: huge thanks to George Stephanis for pointing me towards the above mentioned customize related posts resource.

Using Jetpack’s new Related Posts module yet? Thoughts?

By Brin Wilson

Founder of WinningWP - passionate about all things WordPress! Find me on Twitter.
Comments (policy)
  1. Frances Suzanne says:

    This is great (I was having a hard time finding a code that actually works), but you should display it in a way that we can copy and paste. It’s hard to copy by typing everything, specially for people that don’t code!

Leave a Reply

Your email address will not be published. Required fields are marked *

All comments are held for moderation. We'll only publish comments that are on topic and adhere to our Commenting Policy.

Our commenting form also supports the use of Markdown.