Show Related Posts in Genesis without any Plugin

Showing related post below every article is one of the best way to control the bounce rate of your website, as users get more content on related topics. You can you use some great plugins like WordPress Related Posts, Yet Another Related Posts Plugin, Relevant  to solve this purpose. But it’s always better to  use less number of plugins to keep website fast loading. If you are a Genesis framework user you can easily show related posts below every post by adding some php code in child theme’s functions.php file. But before any experiments please backup your blog. If something goes wrong your blog will not load.

You can use the inbuilt editor of WordPress to add the code, but it’s better to download functions.php from child theme folder inside  /wp-content/theme folder of WordPress. There are two options for related posts, you can show them according to categories or tags attached with post, with a bit of coding knowledge you can create related post function with both tags that will be more precise.

Update: Show Related Posts with Thumbnails in Genesis without any Plugin

Related post based on category:

Code for tag based related post display is nearly about same. Just replace all “cat” with “tag” and “categories” with “tags”. To change number of related posts shown change the number in [ showposts => 4,  ] line , to ignore sticky posts to appear in related section just change the number “0” to “1” in [ignore_sticky_posts => 0,] line.

Those using old version of Genesis framework or child themes will face problem with this code as they have recently added HTML5 Markup on all the themes. To solve it just replace genesis_after_entry_content‘ with ‘genesis_after_post_content‘.

Thats all for now will be back with some new Genesis tutorials soon. Have any query ? Just comment below.

68 thoughts on “Show Related Posts in Genesis without any Plugin”

  1. I am so happy you posted this. I need this because my hosting provider does not allow the popular related post plugins. I currently use special post plugin from codecanyon that is awesome. They also cache the query so it’s not hitting the database every time. I believe it does a refresh every 24 hours.

    Could you update the code to do that?

    Reply
  2. am so happy you posted this. I need this because my hosting provider does not allow the popular related post plugins. I currently use special post plugin from codecanyon that is awesome. They also cache the query so it’s not hitting the database every time. I believe it does a refresh every 24 hours.

    Could you update the code to do that?

    Reply
  3. Nice tutorial. Explained easily.
    It would be good if this feature was built in because some people do not like coding at all.
    Thanks Arup.

    Reply
  4. Arup this is awesome! thank you so much for sharing.
    Can you explaim me again how to add thumbnails?
    thank you so much!

    Reply
  5. That’s what i was looking for. Installing a number of plugins eventually slows down wordpress. This code will do up the task. Thanks Arup Bro for sharing with us.

    Reply
  6. Thanks for the effort to provide this code. But it’s not working on my site. Can you please have a look and resolve it?

    Reply
  7. Hey thanks for this!

    However, is there anyway to make it more complex? Maybe make it related based on Categories & Tags combined?

    Thanks!

    Reply
  8. Hello Sir, Thank you for sharing codes with us. I have done little modification of code snippet and CSS in two ways. I hope you gotta like this to see; you can visit: bit.ly/2HqCxDd

    Reply
  9. Hi thanks for your article, it works fine but i’m Wondering if is possible to add the post excerpt as well

    Reply
  10. first of all great post, I have implemented this on my website, and it works is there any way to show post thumbnails… thanx for share this

    Reply
  11. Hi, Arup sir thanks for code of related post… this code is working fine but I want to show related post from parent category only and not from all selected category.. how can I achieve this? please sir help

    Reply
  12. Code works great for me on normal posts, but on another website I only use custom post type posts, and it will not show anything. What do I need to change in the code to have it working with CPT posts?

    Reply
  13. Hi, Thank you but i have questions about it. I don’t want to count 1,2,3. How can i remove it. And second question is that i want to title h3 is ok but related posts should be h2. How can do it?

    Reply
  14. first of all, great post. i have 3 category and in each have 10 content. for each content i create tags. now this code what does work? and please tell maybe has wrong for show relate content? thanks

    Reply
  15. Hello. Thanks for this good post.
    I have some more specialized questions.
    What is the best way to find links:
    1- Within a category
    2- Within all categories of the entire site
    3- Within all tags
    4- Within the tags of a category
    5- If we assume that the current article is placed in a category that contains 100 other articles in the same category, it is undoubtedly better to look for common tags in the same category, but the question is which tags should be displayed in priority. are. Maybe my tagging is wrong because some articles may have 7 tags and others 2 tags and even one.
    Please guide me completely as I am really confused.

    Reply

Leave a Comment