Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1320938

    I’ve scoured the forums and Google results but haven’t been able to figure out how to show related posts.
    There are some posts saying there’s an add-on/plugin with a Github link that resolves in 404.
    Other posts are saying it needs to be activated in the Theme Options > Blog Layout > Related Posts — but I don’t have any option there that looks at all related.
    Some posts show screenshots of a layout element for Related Posts. Again, no such element in my builder.

    Use case specifics:
    I have a custom post type and taxonomy (both created with Pods). Layout builder works just fine and everything renders as expected.
    There are ~30 posts, all tagged. I would like to show the top related posts at the bottom of the page.

    Thanks for your help. Happy to supply login info if needed.

    #1321031

    Hey SpeedofLike,

    Thank you for the inquiry.

    Looks like you are using the Advance Layout Builder (ALB) to create the content of the posts. You may have to use any of the posts elements (blog posts, magazine, post slider) and add it to the post to create a related posts section. However, if you would like to automatically add a related post section for post created using the ALB, please try this snippet in the functions.php file.

    function avia_add_social_toolbar_template_builder($content = "")
    {
        if (!is_singular("post")) return $content;
        ob_start();
        get_template_part( 'includes/related-posts' );
        $related = ob_get_clean();
    
        $content .= $related;
        $content .= '';
        return $content;
    }
    add_filter('avf_template_builder_content', 'avia_add_social_toolbar_template_builder', 10, 1);
    

    Best regards,
    Ismael

    #1322070

    Thanks for the reply, Ismael.

    I tried inserting your snippet in my functions.php and it removed all my page content on the front end (every page became just the menu and footer), so that didn’t work :).

    Any other ideas? I thought there was a module in ALB for related posts, or a toggle somewhere to do it automatically.

    Also, to clarify, I want to be able to call it on some custom post types, not necessarily all posts on the site.

    #1322194

    Hi,

    Sorry about that. There was a minor error in the filter. We adjusted it now. Please try it again and let us know if it changes anything. We updated the following line.

    if (!is_singular("post")) return $content;
    

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.