Hi, I have three questions about “Related Posts” if they can be implemented or get directions to manually do them.
1) Can we exclude categories or tags? That is if I have some categories or tags that for some reason I don’t want to get related posts from, can I somehow tell the theme to exclude these if they exist from the list of related posts that will be generated?
2) If we get related posts by tag, but for some reason a post doesn’t have any tags, can we get related posts by categories? That is if my preference of related posts does not exist, go to secondary type of taxonomy for related posts. (If I have 1st choice tags, and no tags found, check over categories).
3) Category or Tag weight. That is give more importance over posts comming from one or more categories/tags compared to others having lower weight.
Hi,
1. Try this: http://screencast.com/t/HHQV9KFc2 and write the categories that you want to exclude with -, this will exclude on the entire site those categories to appear in related.
2. Add this code like here: http://screencast.com/t/e6FQys4Jj8
if(!has_tag($live_filter_cur_post_id)) {
$live_filter = 'cur_post_same_categories';
}
3. Thanks for the suggestion
Hello,
in the past this worked. However now (maybe because of some update the files got rewritten), I tried to put again the values as shown in (http://screencast.com/t/HHQV9KFc2) for excluding categories from posts, but they don’t seem to have any effect.
As I see this is in the speed-booster location. I have enabled speedbooster and it seems to be working in the system status (Speed Booster i v4.1 – Active)
-
This reply was modified 10 years by
neakriti.
Its not speedbooster related (I’m stupid to even mention that), but it still seems like it ignores this section completely. Even if I comment out the entire section where that code is to be inserted, it works normally.
Has this functionality moved to some other location in your theme?
Hi,
The code is still there and it should work like before, I have tested this like in you example to see if it works. I have excluded the related posts by tags and excluded the current category:
* Before – http://screencast.com/t/8skxTr1t
* Exclude the Video category – http://screencast.com/t/d2LLt5ZQkM
* Result – http://screencast.com/t/hM21F16d1vh
Thanks!
Hello,
Unfortunately for tags there is no exclude as there is for categories. Tags do not have exclude capabilities. sorry. Here is the wordpress refference for tags https://codex.wordpress.org/Class_Reference/WP_Query (scroll down to the tags parameters)
Thank you!
