SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30
SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30
BACK TO TOP

How to Create Separate RSS Feeds for Each Category in WordPress

How to Create Separate RSS Feeds for Each Category in WordPress

Creating content is par for the course if you are running anything like a blog or a magazine, but what you really want is to make it as easy as possible for people to find and access your content. One way of doing that is getting acquainted with the basics of SEO, while another is to keep your website well organized and sorted into taxonomies.

WordPress taxonomies (categories, tags, and other custom taxonomies) make it easy for your visitors to find the content they are looking for on your website, and there are many ways in which they can do that. You could, for instance, add a most popular tag cloud to your website, allow your visitors to search by category, display recent posts from a category, and more. In this tutorial, we will be showing you how to set up RSS feeds by category in WordPress.

Here‘s what we will be covering:

Qode Themes: Top Picks
Bridge New Banner
Bridge

Creative Multi-Purpose WordPress Theme

Stockholm WordPress Theme
Stockholm

A Genuinely Multi-Concept Theme

Startit WordPress Theme
Startit

Fresh Startup Business Theme

What Is an RSS Feed

RSS stands for Really Simple Syndication: a web feed which allows users to follow updates on websites they want updates from as part of a structured XML document. The document includes a summary of metadata for some of the recent posts published on a website: title, content, excerpt, publication date, categories, and other data.

In order to access the content, RSS users don‘t use a browser, but rather special software called an RSS feed reader or news aggregator. This software is used to create feeds (typically, but not limited to, news feeds) which the user can tailor to suit their own needs or tastes. WordPress accommodates these users by default: there is an infrastructure already in place.

How to Locate an RSS Feed for a Category

As we have mentioned in the section above, there is nothing special a WordPress admin or developer needs to do in order for a website RSS feed to exist. For any WordPress website, you can access its default RSS feed by adding /feed to the website URL.

For instance, you can access the Qode Magazine RSS feed on this link:

However, you may be interested in a particular category only, rather than the entirety of the content on our website. Say you want to locate the Tutorials category, for instance. You can find a link to it under the title of any tutorial article or in the category menu on the left hand-side.

Tutorials Category

You can, then, access the RSS feed for Qode Magazine‘s RSS feed on this link:

Any website, however, can use any number of different and differently named categories for their posts. You can find out what they are for each post from the Posts screen of your WordPress dashboard.

Category

You can also access and edit them by navigating to Posts/Categories from your WordPress dashboard.

Post Categories

A typical WordPress category URL contains category/slug at the end, where slug is the URL-friendly version of the category name.

How to Set Up an RSS Feed for a Category

In a sense, we have already answered this: you can easily share a link to each category‘s individual feed or add it as a hyperlink anywhere on your website.

However, you may delete a category or edit it or its slug at some point, and you or your users will need to manually update all the links for all the feeds they wish to access.

To do that, you need to make a small modification to your website‘s code, specifically, its functions.php file. To access it, navigate to Appearance/Theme Editor from your WordPress dashboard.

Theme Editor

From the right hand-side menu, select your functions.php file and add this code to it, taking care not to disturb any other code:

function display_category_feed() {
$html .= '<ul>';
$html .= wp_list_categories( array(
'orderby' => 'name',
'show_count' => true,
'feed_image' => '/path/to/feed_image.png',
'echo' => false,
) );
$html .= '</ul>';
return $html;
}
add_shortcode('category-feed', 'display_category_feed' );

You will, of course, need to replace /path/to/feed_image.png with the URL of an image in your media library which you wish to use as a feed icon. We will use a white arrow icon, but the choice is, of course, yours.

When done, click the Update File button.

Add Code

This code creates a custom shortcode which you can use anywhere on your website to display a list of category RSS feeds. As an example, we will show you how to display as a shortcode block on the homepage of our website, but you are not limited in your usage of shortcodes or page editor.

After navigating to Appearance/Widgets, locate the widget area where you wish to display your category feeds. Note that the number and names of your widget areas vary from theme to theme. Click the plus sign and select a Shortcode block.

Widgets Add Block

Paste this shortcode into the block’s field: [category-feed]. Click the Update button.

Shortcode

And there you have it, our category RSS feeds are in our test website‘s footer.

Footer Feed

This way, our category feeds will be updated if a new category is added or if an old one is deleted or its name changed.

In Conclusion

As we have shown, RSS feed users can rely on WordPress to provide them with the RSS feed they wish, be that the feed for the entire website or one of its categories, but only provided they know the slug for each category they are interested in. Sure, they can find out what it is with a little research, but we‘d venture to say that a vast majority of website users (and that goes for any website) would take a straightforward link to what they need in favour of a digital scavenger hunt, fun though it may be. In this article, we have shown you how to locate and display a custom, category-based RSS feed on your website and provide your visitors with a simpler, more intuitive experience.

Post your comment

Comments0