Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter oncidium

    (@oncidium)

    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?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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');
    Thread Starter oncidium

    (@oncidium)

    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’))`

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

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

    The ampersand is important. I forgot it.

    Thread Starter oncidium

    (@oncidium)

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

    Thread Starter oncidium

    (@oncidium)

    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?

    Thread Starter oncidium

    (@oncidium)

    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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Thread Starter oncidium

    (@oncidium)

    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)

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Thread Starter oncidium

    (@oncidium)

    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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Try this instead:

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

    (@oncidium)

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

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

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

    Thread Starter oncidium

    (@oncidium)

    HOT DOG! You got it. Huge thank you!!!!!!!!!!!!!! 🙂

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘built in category feed will not work’ is closed to new replies.