-
AuthorPosts
-
January 5, 2021 at 9:42 pm #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,
MicroserveJanuary 8, 2021 at 2:24 pm #1271071Hey 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,
IsmaelJanuary 8, 2021 at 9:54 pm #1271160Hi,
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,
HarryJanuary 11, 2021 at 1:33 pm #1271587Hi,
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,
IsmaelJanuary 12, 2021 at 1:31 am #1271717Hi,
Thank you, I got it to work on my end as well.
Best regards,
MicroserveJanuary 12, 2021 at 6:42 am #1271745Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Blog Layout Related Entries to Recent Entries Instead’ is closed to new replies.
