Display & Style Related Posts For Your WordPress Site

Displaying related posts is a great way to keep readers on your blog and this tutorial will show you how to achieve just this! There are definitely many related posts plugins out there that would be great to use, however I couldn't find any plugins that fit exactly what I needed. So after a lot of reading and researching, here's what I ended up with that's helped me on a ton of my client's projects including my own. Here I will show you how to program a custom WordPress loop that will display your related posts with thumbnails.

Step 1 Edit your functions.php file

First thing's first, open up your functions.php file and add this little bit of code:

Be sure to replace the 196 and 110 with your own dimensions. Save it and upload the file. After you upload it, in your post sidebar you'll see a new option titled "featured image". You can upload any image you want to use here and this will be the image that will display in the related posts section. And make sure you tag all of your posts with at least one keyword. That way when you use this code, you can actually display other posts with any specific tag that the current post has.

Step 2 Edit your single.php file

Now, open your single.php file and add this block of code anywhere you want the related posts section to show up.