This brief tutorial explains two methods for adding RSS feed link icons to category listings. Let’s say that you have a list of category links, where each link targets a specific category view. Now let’s say that, next to each category link, you would like to provide a icon that links to that particular category’s syndicated feed. So, rather than cluttering up your page with two sets of category links — one for category views and another for category feeds — consolidate links and simplify your site by providing both sets of links in a logical, streamlined format.
Method One: A Static Category/Category-Feed List via wp_list_cats
Category Links via "wp_list_cats" The easiest way to create a set of category/category-feed links is to use the native WordPress function,
wp_list_cats. This function creates a customizable set of static category links that may be used in or out of the WordPress loop.
Category links created this way are static in that the same categories are displayed for every type of page view. Thus, if configured to display categories "A", "B", and "C", the
wp_list_cats function will create links for A, B, and C for post views, page views, archive views, category views, and every other view-type for that matter.
Nonetheless, despite this limitation,
wp_list_cats provides an easy way to create a category feed icon links next their respective category links. Simply add the following to the location of your choice within your WP-powered document:
<?php wp_list_cats('feed_image=http://domain.com/path/feed-icon.gif&feed=XML Feed&optioncount=1&children=0'); ?>
In this code example, we are using the following parameters:
- This parameter creates the feed icon link next to each category link. Change the domain, path, and file name according to your particular setup.
- This parameter produces the requisite
titleattributes for the specified feed icon (if any), and also produces
titleattributes for link anchor tags.
- This parameter indicates whether or not the function writes the category post count next to the link. "1" = yes, please display category post counts, "2" = no, please do not display post counts.
- This parameter instructs the function to include or exclude subcategories in the set of category links. "1" = yes, please show all subcategories, "2" = no, please omit any subcategories from the category list.
This function also provides several handy parameters that are not discussed here. Please see the WordPress Codex1 for complete information concerning
Method Two: A Dynamic Category/Feed List via Category LiveBookmarks
A more sophisticated, comprehensive method of providing users with category/feed links is delivered via Monzilla Media’s essential plugin, Category LiveBookmarks Plus 2. Category LiveBookmarks Plus (CLB+) automatically produces a highly customizable set of dynamic category/feed links anywhere within your WP-powered blog. Plus, in addition to creating a custom set of feed links, CLB+ also creates contextually relevant LiveBookmark autodiscovery feed links to the head element of your document (see plugin page for more details). Here are a few examples of the different format options available via CLB+:
Left-aligned feed links
Text-based feed links
Right-aligned feed links
Of course, more configurations are possible, as well as many other customizable settings that enable users to create an ideal set of dynamically changing feed links throughout your site. Simply install the plugin and change the settings within the plugin file to customize your own set of category/feed links. Further, the CLB+ plugin creates a dynamic set of category/feed links that changes according to page view-type in order to provide only relevant feeds, as referenced via the particular page contents.
Regardless of which method you use, consolidating your category links with your category feed links will reduce clutter, streamline navigation, and promote simplicity. Thanks for listening — God Bless!