Forums

RSS "Subscribe" link on a category's archive page? (5 posts)

  1. dmetzcher
    Member
    Posted 6 years ago #

    I would like to add a link to the RSS feed to the individual page for each category archive. An example would be: http://www.mymacblog.com/index.php/category/software/mac-os-x/

    That's one of my catgories. Just under "Archive for the 'Mac OS X' Category" text at the top, I'd like to add a "Subscribe" link that points to the RSS feed for that category. How can this be done? I would like the format to be "feed:http://www.website.com/category/categoryname", and not "http://www.website.com/category/categoryname". I can get the latter working, but can't get it working where I have "feed:" before the RSS link in the link itself. Is there a function that will get this done, or can someone post some code that I can add to the archive.php template (the one that generates the page listed above in the first paragraph)?

    Thanks!

  2. James
    Happiness Engineer
    Posted 6 years ago #

    Add this tag to your theme's Category template:

    <?php the_category_rss() ?>

    More info: http://codex.wordpress.org/Template_Tags/the_category_rss

    ::Edit:: Never mind, that's not it. Hang on for a sec.

  3. James
    Happiness Engineer
    Posted 6 years ago #

    Ugh, this is icky. It looks like the jury is still out on this one. You may be able to get by if you add this to your theme's Category template, but I can't promise that it'll work:

    <?php wp_list_cats('feed=rss2'); ?>

    More info: http://codex.wordpress.org/Template_Tags/wp_list_cats

  4. dmetzcher
    Member
    Posted 6 years ago #

    Yeah, neither worked. Thanks for trying though. :-)
    Anyone else have any ideas? This has to have been done somewhere.

  5. dmetzcher
    Member
    Posted 6 years ago #

    I found a not-so-graceful way to get this done. Add the following code just under <h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2>.
    ----------------------------------------------------------
    <p align="center"><a href="feed:http://www.website.com/index.php/category/<?php echo single_cat_title(); ?>/feed/"><img style="vertical-align:middle" src="/wp-content/themes/default/images/badge_xml_rss2.png"></a> <a href="feed:http://www.website.com/index.php/category/<?php echo single_cat_title(); ?>/feed/">Subscribe to the RSS 2.0 feed for this category.</a>

    ----------------------------------------------------------
    This is all done in the archive.php file.

    Obviously, you have to change "website.com" to your domain. It is in two places above.

    Until something better comes along, this will have to do.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags