WordPress Guy

Category feeds

Did you know that WordPress comes with the ability to publish category feeds? That’s right, you can give that option to your readers by providing them with the category feed. Or, you can subscribe to a blog where you’re only interested in one of the categories. This is what their URL looks like:

If you’re using “pretty” permalinks:

http://yourblog.com/category/categoryname/feed

Or if you’re using query string permalinks (the un-pretty ones):

http://yourblog.com/wp-rss2.php?cat=14

Where 14 is the ID of the category.

You can add this to your archive.php with the following code:

<?php if(is_category()) : ?>
<a href="<?php echo bloginfo("url") . "/wp-rss2.php?cat=$cat" ?>">Subscribe to the <?php single_cat_title(); ?> category</a>
<?php endif; ?>

Cool eh!

Your Comment