I've recently created a WordPress plugin to list feeds by category that I thought I'd share with the world. Basically, rather than having only one feed url that shows all of your posts, this plugin allows people to subscribe to only the categories they want to receive updates from via RSS. The code is based off of old WordPress core code for list_cats function. You can see an example of it in the sidebar here: http://www.ben-huddleston.com/. More info after the jump.
How it works
Function Call
You simply insert this function call in your template where you would like the feeds to show up. You can create a page template (see included feeds.php example) or input the function call into your sidebar, footer, whatever. This will list the categories and child categories in an unordered list. You can see an example of it in the sidebar here: http://www.ben-huddleston.com/.< ?php rs_category_feeds(); ?>
Full Function Call with parameters listed
< ?php rs_category_feeds(optionall, 'all', 'sort_column', 'sort_order', 'file', list, optiondates, optioncount, hide_empty, use_desc_for_title, children, child_of, 'Categories', recurse, 'feed', 'feed_img', 'exclude', hierarchical); ?>
Installation
- Download the plugin.
- Unzip the zip file
- Upload the rs_catfeeds.php file (not the whole folder, just the file) into your plugins directory on your WP site
- Log into the admin side of your WP site and activate the Plugin (Called Redwing Studio Category Feeds)
- Edit your template to input the function call where you would like the links to be generated.
- You can integrate the function call into a sidebar, footer, whatever of the template.
- You may also integrate the function call into a page template (see included feeds.php file for an example). You then have to create a page in the WP admin and assign the Feeds template to that page.
Parameters
optionall
(boolean) Sets whether to display a link to all Categories. Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Valid values:
* TRUE (Default)
* FALSE
all
(string) If optionall is set to TRUE, this defines the text to be displayed for the link to all Categories. Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Defaults to 'All'.
sort_column
(string) Key to sort options by. Valid values:
* 'ID' (Default)
* 'name'
sort_order
(string) Sort order for options. Valid values:
* 'asc' (Default)
* 'desc'
file
(string) The php file a Category link is to be displayed on. Defaults to 'index.php'.
list
(boolean) Sets whether the Categories are enclosed in an unordered list (<ul><li>). Valid values:
* TRUE (Default)
* FALSE
optiondates
(boolean) Sets whether to display the date of the last post in each Category. Valid values:
* TRUE
* FALSE (Default)
optioncount
(boolean) Sets whether to display a count of posts in each Category. Valid values:
* TRUE
* FALSE (Default)
hide_empty
(boolean) Sets whether to hide (not display) Categories with no posts. Valid values:
* TRUE (Default)
* FALSE
use_desc_for_title
(boolean) Sets whether the Category description is displayed as link title (i.e. <a title="Category Description" xhref="…). Valid values:
* TRUE (Default)
* FALSE
children
(boolean) Sets whether to show children (sub) Categories. Valid values:
* TRUE (Default)
* FALSE
child_of
(integer) Display only the Categories that are children of this Category (ID number). There is no default.
Categories
(integer) This parameter should be set to 0 (zero) when calling this template tag. (For the curious, other values are used only internally by the tag when generating a hierarchical list.)
recurse
(boolean) Display the list (FALSE) or return it for use in PHP (TRUE). Defaults to FALSE.
feed
(string) dummy field. used to spit feed link out next to category name. leave blank.
feed_image
(string) Path/filename for a graphic to act as a link to each Category's RSS2 feed. Overrides the feed parameter.
exclude
(string) Sets the Categories to be excluded. This must be in the form of an array (ex: '1, 2, 3').
hierarchical
(boolean) Sets whether to display child (sub) Categories in a hierarchical (after parent) list. Valid values:
* TRUE (Default)
* FALSE