WordPress category feed plugin draugiem.lvtwitter.comfacebook.comDrukāt

CatFeed

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 ;)

Description

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 } ?>
  4.  
  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 } ?>
  8.  
  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 ;)

11 atbildes uz “WordPress category feed plugin”

  1. baron saka:

    hi. Thanks for plugin

    perfect.

    Regards

  2. eb saka:

    You are welcome!

  3. scribu saka:

    Hi, just wanted to let you know that I have a similar plugin. It’s called “Extra Feed Links”. :hello:

  4. eb saka:

    :D Nice one! Sometimes it is hard to find something you are looking for. I wouldn’t make mine if I could find yours before!

  5. mersenne saka:

    hi,
    i’ve been looking for something like this and i tried the extra feed links by scribu, it gave some xml errors probably because i suck but anyways, yours worked out of the box, so thanks a lot for that!

  6. eb saka:

    I’m glad to hear that! :)

  7. Joss Winn saka:

    Hi,

    Your plugin is exactly what I’ve been looking for. However, it doesn’t work with WordPress MU. It won’t work with WordPress soon either as plugins have to register their options: codex.wordpress.org/…

    I was wondering if you’d update your plugin to be forward compatible with WordPress and compatible with WPMU?

    Thank you

  8. eb saka:

    I’m quite busy right now but will look into this.

  9. Jani saka:

    Nice, the alternative code was precisely what I needed. Thank you for posting this!

    Now if only I knew how to fill in those strangely labeled fields above this comment box… (Just kidding, the labels are pretty obvious for anyone who has ever used WordPress.)

  10. eb saka:

    These additional feed links is now built-in starting WordPress 2.8!

  11. [...] learned this from the author of this related plugin, which is similar but not quite as powerful as the Extra Feed Links [...]



Pieslēgties