With this code I can display category feeds in the sidebar:
<?php
$cats = get_the_category();
$num = count($cats);
for($i=0; $i<$num; $i++)
{
$cat=$cats[$i];
echo '<a href="';
get_category_rss_link(true,$cat->cat_ID,$cat->category_nicename);
echo '">'.$cat->cat_name.'</a>';
if ($i != $num-1) echo ', ';
}
?>
The problem is this will fetch the feeds of all categories assigned to posts pertaining to a category.
What I actually want is a single category feed when viewing a specific category. I suppose this set up succesfully at this support forum ("RSS feed for this forum").
Kind regards,
st
What happens when you do this:
<?php wp_list_categories("include=$cat&feed=RSS&title_li="); ?>
You get:
category a (RSS)
category b (RSS)
category c (RSS) ...
We need a piece of code to display for instance the category A feed link when browsing category A.
Does this actually work?
<?php the_category_rss('type') ?>
(http://codex.wordpress.org/Template_Tags/the_category_rss)
This should work for what you want to do:
<?php
if (is_category()) {
get_category_rss_link(true,get_query_var('cat'),'');
}
?>
get_category_rss_link() is not documented in the codex, as far as I can tell.
Does anyone know if it's possible to have get_category_rss_link() render a link starting with "feed:" rather than "http:" ?
Thanks.