Apologies for misunderstanding your question. When you tag a post to more than one category it will be displayed on both categories. Please correct me if I am not getting you well.
The logic/output for the related posts is handled in the function "nectar_related_post_display" in salient/nectar/helpers/blog.php, if you'd like to examine it or copy it to your child for modification.
It works by running a query for posts in any of the categories which are assigned to the current post being viewed.
I'm trying to get to the bottom of the logic for that query. If a post is assigned to only 1 category, I assume it takes the next 3 most recent posts in the same category.
But what if a post is assigned to 5 categories?
Or does it take other factors into account - most viewed posts etc.
Thanks for your help as always - your support is fantastic.
There are no other factors taken into consideration for the query other than the current set of categories assigned to the currently viewed post. If the post being viewed has 5 categories assigned, then the first 3 posts (by date) that exist in any of those 5 categories will be output.
The Yoast plug-in allows the option to make one category a 'Primary Category'. Would the 'related posts' logic then display posts from the primary category only or would the same logic apply.
Unfortunately, there's no logic in place to take the primary category from Yoast settings into account - the "nectar_related_post_display" function would need to be copied into your child and modified to implement that.
Hi there,
What logic is used for related posts if a post is tagged to more than 1 category?
Thanks, Si
Hi Simon,
This might help:https://wordpress.com/support/related-posts/.
Thanks.
Sorry Andrew, I'm not sure how this applies to my question?
Seems to be about Wordpress.com
Si
Hi Simon,
Related posts are posts under same category and you can use a third-party plugin to show similar posts like this one https://wordpress.org/plugins/similar-posts/
Hope this helps.
Regards,
Thanks Andrew.
My question was around posts that are tagged to more than 1 category.
What is the logic in that case?
And then does it take the next 3 most recent or use some other filter?
Si
Hi Simon,
Apologies for misunderstanding your question. When you tag a post to more than one category it will be displayed on both categories. Please correct me if I am not getting you well.
Best regards,
Thanks for getting back to me Andrew.
I'll try and explain better
http://auroradvlpmnt.wpengine.com/insight/french-renewables-forecast-october-2020/
So if a post is tagged to 3 different categories, what 3 related posts are shown?
Thanks, Si
Just checking in here to see if I can get to the bottom of this one.
Many thanks, Si
Hey Simon,
The logic/output for the related posts is handled in the function "nectar_related_post_display" in salient/nectar/helpers/blog.php, if you'd like to examine it or copy it to your child for modification.
It works by running a query for posts in any of the categories which are assigned to the current post being viewed.
Hi
Many thanks for getting back to me.
I'm trying to get to the bottom of the logic for that query. If a post is assigned to only 1 category, I assume it takes the next 3 most recent posts in the same category.
But what if a post is assigned to 5 categories?
Or does it take other factors into account - most viewed posts etc.
Thanks for your help as always - your support is fantastic.
Si
Glad I could help, Simon
There are no other factors taken into consideration for the query other than the current set of categories assigned to the currently viewed post. If the post being viewed has 5 categories assigned, then the first 3 posts (by date) that exist in any of those 5 categories will be output.
Cool, that makes sense.
Sorry, one more question if that is ok.
The Yoast plug-in allows the option to make one category a 'Primary Category'. Would the 'related posts' logic then display posts from the primary category only or would the same logic apply.
Unfortunately, there's no logic in place to take the primary category from Yoast settings into account - the "nectar_related_post_display" function would need to be copied into your child and modified to implement that.