Forums

Category feeds (6 posts)

  1. stoic
    Member
    Posted 5 years ago #

    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

  2. Glenn Ansley
    Member
    Posted 5 years ago #

    What happens when you do this:

    <?php wp_list_categories("include=$cat&feed=RSS&title_li="); ?>
  3. stoic
    Member
    Posted 5 years ago #

    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.

  4. stoic
    Member
    Posted 5 years ago #

    Does this actually work?

    <?php the_category_rss('type') ?>

    (http://codex.wordpress.org/Template_Tags/the_category_rss)

  5. Otto
    Tech Ninja
    Posted 4 years ago #

    This should work for what you want to do:

    <?php
    if (is_category()) {
    get_category_rss_link(true,get_query_var('cat'),'');
    }
    ?>
  6. shacker
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic