WordPress.org

Forums

[resolved] Add an RSS icon to each category page (5 posts)

  1. kReEsTaL
    Member
    Posted 8 years ago #

    Hi,

    I wonder how you can add a category RSS icon, linked to relative feed, besise the title on each category archive page.

    I.e: on this page, which is the category archive page for the Cinema category, I'd like to add the 'Cinema' RSS feed icon beside the 'Archives pour la categorie Cinema' title.

    Any help please? :)

    Thanks in advance.

  2. kReEsTaL
    Member
    Posted 8 years ago #

    I found the solution all by myself, despite being no PHP geek (thanks to the Codex for nice explanations about get category link, even though it took me a while to find the right tag to use).

    In case anyone is interested, here is the solution to display a feed icon of the category you're currently browsing:

    <?php echo '<a href="'. get_category_link($cat) . 'feed" title="Really Simple Syndication"><img src="'. get_bloginfo('template_directory') .'/images/rss.gif" /></a>'; ?>

    Yay me! :-D

    Result can be viewed on my blog.

  3. sunburntkamel
    Member
    Posted 7 years ago #

    slightly more precise method, via otto42 through lorelle:

    <a href="<?php get_category_rss_link(true,$cat,$cat); ?>" title="<?php echo single_cat_title(); ?> feed"><img src="<?php bloginfo('template_directory') ?>/icons/rss.png" alt="feed icon" title="<?php echo single_cat_title(); ?> feed" /></a>

  4. Stillman
    Member
    Posted 7 years ago #

    Where would you put this code exactly? I'm using a theme that didn't include RSS links at all, but would really like to add them to each article.

    Thanks!!
    __

  5. This Blog Sucks
    Member
    Posted 7 years ago #

    Cool... now does anyone know how to make this happen with Feedburner?

    I'm using this to call the category in my archive page:

    <a href="?feed=rss2&cat=<?php echo get_query_var('cat'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="RSS for this category only"><img src="http://www.blogexperiment.org/images/feed-icon-14x14.gif"></abbr>'); ?></a>

    But it's not a feedburner feed, it's just regular RSS.

    You can see what I mean when you click the RSS icon next to the Category name here:
    http://www.blogexperiment.org/blog/category/videos/

    Thanks,
    Michael

Topic Closed

This topic has been closed to new replies.

About this Topic