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?
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');
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’))`
My bad. Try this:
query_posts($query_string . "&cat=-12");
The ampersand is important. I forgot it.
I added the & but it still shows up in the main feed. Could it be the theme I’m using preventing this from working?
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?
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.
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.
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)
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.
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.
Try this instead:
function limit_feed() {
if (is_feed() && !is_category()) {
query_posts($query_string . "&cat=-12");
}
}
add_action('rss2_head','limit_feed');
Bummer. I tried changing to the default theme too and that had no effect.
oncisium: Sorry, I was editing. Try the new code I gave above.
HOT DOG! You got it. Huge thank you!!!!!!!!!!!!!! 🙂