WordPress category feed plugin


I wanted to add WordPress category feed auto-discovery links to category views. So I came up with the code for template. Little bit later I thought of making it a plugin and here it is:

Download: CatFeed @ WordPress.org;

In the process of making it I added tag feeds for tag views and comment feeds for single post views. It turned out to be very useful for me so here is the attempt to make it public.

I am not a php programmer but if you know c++ then it’s not hard to do some coding in php- I’m not sure of the style though 😉


Adds category, tag and comment feed auto-discovery links. Category feed links are added only to category views, tag feed links to tag views and comment feed links to single post views.

Alternative: code for templates

  1. <?php if (is_category()) { ?>
  2. <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> &raquo; <?php single_cat_title(''); ?>" href="<?php echo get_category_feed_link(get_query_var('cat'), 'atom'); ?>" />
  3. <?php } ?>
  5. <?php if (is_tag()) { ?>
  6. <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> &raquo; <?php single_tag_title(''); ?>" href="<?php echo get_tag_feed_link(get_query_var('tag_id'), 'atom'); ?>" />
  7. <?php } ?>
  9. <?php if (is_single() || is_page()) { ?>
  10. <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> &raquo; <?php single_post_title(''); ?>" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
  11. <?php } ?>

Just change this code to meet your preferences and add it to header.php somewhere between <head> and </head>. Usually header.php by default will contain similar tag for site wide post feeds. You may want to add this code right after that. If you prefer rss feeds over atom you need to change “application/atom+xml” to “application/rss+xml” and ‘atom’ to ‘rss2’ (v2.0) or ‘rss’ (v0.92).

Note: This is obsolete 😉

Birkas: , , , , , , , , , , , , ,

categories Tehnoloģijas | datetime 08 Nov 2008 15:30