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
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
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
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
Hi,
Thank you, I got it to work on my end as well.
Best regards,
Microserve
Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon