[Plugin: Ultimate Category Excluder] Exclude from home page and main RSS but not category RSS?
-
Is it possible to exclude categories from the main blog page and the main RSS feed, but keep the category RSS feeds intact?
https://www.ads-software.com/extend/plugins/ultimate-category-excluder/
-
Hi, I don’t think so, because all of the feeds are generated from the same hunk of WordPress code. Are you trying to create private feeds? I’d guess that category is visible only in Archives?
Hmmm, ok. I was wondering because I’ve been using Advanced Category Excluder up until a few days ago, which did allow me to remove categories from the main feed but retain the category feeds. That plugin has issues with my new server though, so I decided to try out UCE.
I’m not trying to create private feeds, just excluding a few special categories that have a lot of activity or have content unrelated to the main blog that I want feeds for, but not to show up in the main feed or post list.
That’s interesting. Let me experiment some, and see what I can discover. It’ll be after Christmas though. I don’t think I’ve ever tried to do what you’re describing.
Cool! I’m going to dig through the code for Advanced Category Excluder (https://www.ads-software.com/extend/plugins/advanced-category-excluder/) and see if I can find clues to how it accomplishes that. That plugin hasn’t been updated for 18 months and doesn’t seem to work on newer server setups, and yours does so I’ll try to help if I can.
Is it possible to exclude categories from the main blog page and the main RSS feed, but keep the category RSS feeds intact?
I am also looking for a solution to this problem.
I was hoping instead of using a plug-in to put some more logic on this PHP statement:
function myFeedExcluder($query) { if ($query->is_feed || $query->is_home ) { $query->set('cat', '-455, -462'); } return $query; } add_filter('pre_get_posts', 'myFeedExcluder');
I will post a solution as soon as I figure it out.
Hi All,
Finally! I got the main RSS feed to exclude categories (https://www.yourwebsite.com/feed), but these posts still show up on their category-specific RSS feed (https://www.yourwebsite.com/category/your-category-name/feed)I did not use the Ultimate Category Excluder module to accomplish this. I modified someone else’s code and put it in my theme’s functions.php file.
Here is the code I used for my site:
[Code moderated as per the Forum Rules. Please use the pastebin]
The only thing you need to modify for your own site are the ‘replace-your-category-name’. Replace it with the slug of the category you want to exclude.
Hope this helps someone out!!Source: (https://www.simonwheatley.co.uk/2011/01/05/excluding-one-category-from-the-main-wordpress-feed/)
hi acoburn4 – could you please post that code you used using pastebin? i cant figure it out based on that link. thanks for any help – this is exactly the same thing i was looking to do!
/jeff
hi happypelican-
In order to exclude a category from my main blog page and RSS feed, but not the category’s specific RSS feed I follow this 2-step process:
1. Exclude category from main blog page (loop.php)
A. Open up your theme’s loop.php
B. Insert the following PHP code at the top of the file: https://pastebin.com/k4y4Jwxt
C. Replace numbers with the id’s of the category you want to exclude (In order to find the ID number, go to your list of categories in WP dashboard, and hover over the one you want to exclude. The URL will contain the ID number of the category. For example, the ID number of this URL is 123: https://www.yourwebsite.com/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=123&post_type=post.)
D. Save file and check main page to be sure category is excluded2. Exclude category from main RSS feed but not category’s RSS feed
A. Open your theme’s functions.php file
B. Insert the following code: https://pastebin.com/QNT6Qhn0
C. Replace excluded-category-slug1 with the name of your slug (In order to find the name of your slug, go to your list of categories in WP dashboard, and find the slug column of the category you want to exclude).
D. Save file and check main RSS feed to be sure category is excluded: https://www.yourwebsite.com/feed
Check category RSS feed to be sure posts still show: https://www.yourwebsite.com/category/slug-goes-here/feedI realize I am filtering by ID for the first step and by slug name for the second. These should probably be consistent and use the same parameter. If anyone wants to clean it up, feel free. I’ve had no reason to b/c it’s been working great for me. Hope this helps someone else!
thank you so much to replying! i really appreciate it, i will try this out now!
thanks acoburn – that worked perfectly. i have noticed something else really weird, i think it may be entirely unrelated-
i have styled each of my categories to highlight tags and underline links a different colour for each category. i added a new category that i wanted to use for personal blog posts and would eventually add a sidebar image so people could subscribe to it separately. your code works perfectly for this.
the weird thing i have noticed is that this category loses its styling only when i am not logged into wordpress. if i am logged in i can see them. all other categories work.
here’s an image of it here: https://www.booooooom.com/wp-content/uploads/2012/04/categoryproblem.jpg
on the left is not logged in, on the right is logged in.
you can also see that the little facebook like also doesn’t load.
so if you go to this link you won’t see any of the highlighted tags/underlined links:
https://www.booooooom.com/blog/jeff/here is a portion of my style.css where i specify the blog colors (lines 43-47 are the new category):
https://pastebin.com/PbKVDHnR– any idea what is going on?
I believe it’s broken b/c of your CSS. I looked at your page https://www.booooooom.com/blog/jeff/ and I could not find the class .cat-item-8227 that you are targeting in your style.css
Hope that helps!
thanks acoburn you have been a huge help! really appreciate it, i think its all working now
Thank you so much acoburn! You have helped out tremendously! ??
[UPDATED] Google reader just had trouble updating…your code works great.
Hmm, I’m not having such luck! The posts I’m looking to have their own feed, but not show up in the main feed are not showing…
The posts here … https://thelifedesignproject.com/category/personal-posts/feed/ …. are non existent
I can’t seem to figure out why though, I implemented your code on the functions.php with the correct slug…can you lend a hand?
-r
Works almost perfectly, my main feed shows some of the excluded posts (but not all.. weird!)
- The topic ‘[Plugin: Ultimate Category Excluder] Exclude from home page and main RSS but not category RSS?’ is closed to new replies.