WordPress.org

Ready to get started?Download WordPress

Forums

built in category feed will not work (16 posts)

  1. oncidium
    Member
    Posted 6 years ago #

    I have seen quite a few post on getting a specific category feed and it is built in. After looking at the category feeds page and trying the format, it does not work for me. For example: http://divaknitting.com/blog/category/knitting/feed just brings up a 404 error as does http://divaknitting.com/blog/wp-rrs2.php?cat=12

    Can anyone help with why this isn't working? Am I missing something?

  2. oncidium
    Member
    Posted 6 years ago #

    Ok, I finally found the link that works: http://www.divaknitting.com/blog/?feed=rss2&cat=12 However, what I'd really like to do is have any posts to this category be excluded from the regular site feed. I tried the category visibility plugin, but if I mark the category not to show up in the feed, no feed at all shows for it. Any ideas on how I may be able to accomplish this?

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Try adding this to your theme's functions.php file:

    function limit_feed() {
    if (is_home() && !is_category()) {
    query_posts($query_string . "cat=-12");
    }
    }
    add_action('rss2_head','limit_feed');
  4. oncidium
    Member
    Posted 6 years ago #

    Thank you! Unfortunately, I tried adding the code you suggested, did a test post and it did show up in my main feed. I'm not sure if it matters where in the functions.php code I add this? I put it towards the beginning...see below`load_theme_textdomain ('giraffe');

    //Addition to block category from main feed

    function limit_feed() {
    if (is_home() && !is_category()) {
    query_posts($query_string . "cat=-12");
    }
    }
    add_action('rss2_head','limit_feed');

    //END addition to block category from main feed

    // Register ourself with the widget master
    if (function_exists ('register_sidebar'))`

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    My bad. Try this:
    query_posts($query_string . "&cat=-12");

    The ampersand is important. I forgot it.

  6. oncidium
    Member
    Posted 6 years ago #

    I added the & but it still shows up in the main feed. Could it be the theme I'm using preventing this from working?

  7. oncidium
    Member
    Posted 6 years ago #

    I found this thread which might be relevant: http://wordpress.org/support/topic/78474?replies=13#post-584328 Wondering if I should be editing a different file?

  8. oncidium
    Member
    Posted 6 years ago #

    I had another thought. Using the Feed Locations plugin, shouldn't I just be able to change the default rss feed location from http://www.divaknitting.com/blog/feed=?rss2 http://www.divaknitting.com/blog/?feed=rss2&cat=-12

    I tried it though and the category 12 posts still show up in bloglines, google reader etc. However, when you put http://www.divaknitting.com/blog/?feed=rss2&cat=-12 in the browser the feed shows up just as I would like it to...no category 12.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    I tried it though and the category 12 posts still show up in bloglines, google reader etc.

    Remember that services like these cache your feed, they don't retrieve it fresh every single time. So changes you make to your feed won't show up immediately in online readers.

  10. oncidium
    Member
    Posted 6 years ago #

    DOH! I didn't think of that! I'll change it and leave it alone for a while to see if it works. Frustrating to not be able to see immediately. Do you think it is better to go with your original suggestion or the Feed Locations plugin? I also found something about changing the .htaccess file that I tried (probably same cacheing problem)

  11. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    The only way to tell if something works is to look at the actual content of the feed. When you pull the feed from here in a normal browser:
    http://www.divaknitting.com/blog/?feed=rss2 then it's fresh, every time. No need for using online readers and such.

  12. oncidium
    Member
    Posted 6 years ago #

    Well in that case it still isn't working. I should have been more clear that I had tried the browser too...http://www.divaknitting.com/blog/?feed=rss2 still shows category 12 with both the Feed Locations changed to http://www.divaknitting.com/blog/?feed=rss2&cat=-12 and the mod you specified before. Neither seems to work.

  13. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Try this instead:

    function limit_feed() {
    if (is_feed() && !is_category()) {
    query_posts($query_string . "&cat=-12");
    }
    }
    add_action('rss2_head','limit_feed');
  14. oncidium
    Member
    Posted 6 years ago #

    Bummer. I tried changing to the default theme too and that had no effect.

  15. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    oncisium: Sorry, I was editing. Try the new code I gave above.

  16. oncidium
    Member
    Posted 6 years ago #

    HOT DOG! You got it. Huge thank you!!!!!!!!!!!!!! :)

Topic Closed

This topic has been closed to new replies.

About this Topic