Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1270477

    Hi,

    Is there a way to change the related entries in the blog layout option to show recent entries instead? I want to avoid adding tags to all the existing posts and adding the Blog Post shortcode in the page builder.

    Best regards,
    Microserve

    #1271071

    Hey Microserve_,

    Thank you for the inquiry.

    That should be possible by editing the default query of the get_posts function in the includes > related-posts.php file or template.

      $my_query = get_posts(
                                array(
                                    'tag__in' => $tag_ids,
                                    'post_type' => get_post_type($this_id),
                                    'showposts'=>$postcount, 'ignore_sticky_posts'=>1,
                                    'orderby'=>'rand',
                                    'post__not_in' => array($this_id))
                                );
    

    You may need to remove or adjust the value of the tag__in and the orderby parameters.

    Best regards,
    Ismael

    #1271160

    Hi,

    I’ve experimented with changing and deleting the tag__in and the orderby parameters. I still have an issue where related entries wont show any entries at all without the tags.
    Would you happen to know what the parameters need to be for this to work?

    Best regards,
    Harry

    #1271587

    Hi,

    Thank you for the update.

    It is working properly on our end. This is how the final or modified query should look.

     $my_query = get_posts(
                                array(       
                                    'post_type' => get_post_type($this_id),
                                    'showposts'=>$postcount, 'ignore_sticky_posts'=>1,
                                    'post__not_in' => array($this_id))
                                );
    

    Best regards,
    Ismael

    #1271717

    Hi,

    Thank you, I got it to work on my end as well.

    Best regards,
    Microserve

    #1271745

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Blog Layout Related Entries to Recent Entries Instead’ is closed to new replies.