WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate Category Excluder
Exclude from home page and main RSS but not category RSS? (16 posts)

  1. brohism
    Member
    Posted 2 years ago #

    Is it possible to exclude categories from the main blog page and the main RSS feed, but keep the category RSS feeds intact?

    http://wordpress.org/extend/plugins/ultimate-category-excluder/

  2. Michael Clark
    Member
    Plugin Author

    Posted 2 years ago #

    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?

  3. brohism
    Member
    Posted 2 years ago #

    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.

  4. Michael Clark
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  5. brohism
    Member
    Posted 2 years ago #

    Cool! I'm going to dig through the code for Advanced Category Excluder (http://wordpress.org/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.

  6. acoburn4
    Member
    Posted 2 years ago #

    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.

  7. acoburn4
    Member
    Posted 2 years ago #

    Hi All,
    Finally! I got the main RSS feed to exclude categories (http://www.yourwebsite.com/feed), but these posts still show up on their category-specific RSS feed (http://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: (http://www.simonwheatley.co.uk/2011/01/05/excluding-one-category-from-the-main-wordpress-feed/)

  8. happypelican
    Member
    Posted 2 years ago #

    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

  9. acoburn4
    Member
    Posted 2 years ago #

    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: http://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: http://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 excluded

    2. 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: http://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: http://www.yourwebsite.com/feed
    Check category RSS feed to be sure posts still show: http://www.yourwebsite.com/category/slug-goes-here/feed

    I 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!

  10. happypelican
    Member
    Posted 2 years ago #

    thank you so much to replying! i really appreciate it, i will try this out now!

  11. happypelican
    Member
    Posted 2 years ago #

    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: http://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:
    http://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):
    http://pastebin.com/PbKVDHnR

    - any idea what is going on?

  12. acoburn4
    Member
    Posted 2 years ago #

    I believe it's broken b/c of your CSS. I looked at your page http://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!

  13. happypelican
    Member
    Posted 2 years ago #

    thanks acoburn you have been a huge help! really appreciate it, i think its all working now

  14. Katie
    Member
    Posted 2 years ago #

    Thank you so much acoburn! You have helped out tremendously! :)

  15. robgranholm
    Member
    Posted 1 year ago #

    [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 ... http://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

  16. Benny Powers
    Member
    Posted 1 year ago #

    Works almost perfectly, my main feed shows some of the excluded posts (but not all.. weird!)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic