Related Posts on Single blog post page

Hi there,

I added the related posts code below to my functions.php and it’s adding related posts on all pages. Can you help me to understand what I would add to make it show up only on the single posts? I’ve been trying to get this to work all day and am running into roadblocks. Also, is there a better way to have it suggest related pages based on the categories the existing page has?

function add_global_blocks_single_post(){

echo do_shortcode(’[recent_posts count=“3” orientation=“horizontal” category=“updates”]’);

}

add_action(‘x_after_the_content_end’, ‘add_global_blocks_single_post’);

Hi @bdevries,

Thanks for reaching out.
Although the custom coding is not in the scope of Theme Support, still, I would suggest you check if the code is running on the Single post page. Please go through the following article which may help you with this.

Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.