WordPress.org

Ready to get started?Download WordPress

Forums

Auto-display category RSS feed in category.php (7 posts)

  1. trex33
    Member
    Posted 5 years ago #

    I want to automatically display the applicable category RSS feed on the category.php template. Is there template tag, hack, plugin that will enable me to do this?

    After searching for hours, all I can find is information on how to add category rss feeds manually or through wp_list_categories (which would list RSS feeds for all of the categories).

  2. trex33
    Member
    Posted 5 years ago #

    For what it's worth, here was the solution (after much hair pulling). Display the blog url, then add the dynamic portion of the url followed by "feed":

    <a href="<?php bloginfo('url'); ?>
    <?php echo $_SERVER["REQUEST_URI"]; ?>feed">RSS Feed for Category</a>
  3. wlben
    Member
    Posted 5 years ago #

    Trex33:
    Question.
    Will the above code pull info from a particular place like google reader and put that post into your blog in a new post area?
    Can you determine the number of post that it will retrive and will it retrive that number of posts under a speicific catagorie?
    Also where do you put this code?
    Thanks for the help.
    w.

  4. Chris_K
    Member
    Posted 5 years ago #

    Will the above code pull info from a particular place like google reader and put that post into your blog in a new post area?

    No, all that link does is offer a link to YOUR existing blog's feed for the particular category.

    The search phrase that you're probably looking for will involve "syndication."

  5. trex33
    Member
    Posted 5 years ago #

    CORRECTION: I discovered problem with code above. It creates invalid links when there are multiple pages for the category.

    <a href="<?php bloginfo('url'); ?>
    <?php echo $_SERVER["REQUEST_URI"]; ?>feed">RSS Feed for Category</a>

    The solution below appears to work better. It uses the WP template tag get_category_feed_link and then inserts the category dynamically. You place this in your category.php template.

    Displaying WordPress Category RSS Feed Link

  6. wurp
    Member
    Posted 5 years ago #

    Thanks much, this is just what I was looking for. I updated it a bit and found the new place where it goes.

    In wp-content/themes/default/archive.php, I added:

    div style="text-align: center"><a href="<?php bloginfo('url'); ?>
    <?php echo $_SERVER["REQUEST_URI"]; ?>feed">RSS Feed for the ‘<?php single
    _cat_title(); ?>’ Category</a></div>

    right below the code that was already at the head of the category page:

    <h2 class="pagetitle">Archive for the ‘<?php single_cat_ti
    tle(); ?>’ Category</h2>

    Hope that helps someone!

    Bobby

  7. wurp
    Member
    Posted 5 years ago #

    Er, of course there was a < at the beginning of that div tag I added.

Topic Closed

This topic has been closed to new replies.

About this Topic