How to Make a Separate RSS Feed for Each Category in WordPress - AmazoUpdates

Breaking

Tuesday, October 12, 2021

How to Make a Separate RSS Feed for Each Category in WordPress

Do you want to make a separate RSS feed for each category in WordPress?

Categories allow you to easily sort your content into major sections. Adding category RSS feeds can help your users subscribe to specific areas of your website that interest them.

In this article, we will show you how to easily make a separate RSS feed for each category in WordPress. We’ll also talk about how you can use them effectively to grow your website.

Making RSS feeds for categories in WordPress

Locating RSS Feed for Categories in WordPress

Categories and tags are two of the main default taxonomies in WordPress. They allow you to easily sort and organize your content into different subjects and topics.

By default, each category on your WordPress website has its own RSS feed. You can locate this RSS feed by simply adding ‘feed’ at the end of the category page URL.

For instance, if you had a category called ‘News’ with a URL like this:

https://ift.tt/3DwEp9r

Then its RSS feed would be located at the following URL:

https://ift.tt/3FBxxtn

Tip: You can find your category URL by visiting Posts » Categories page and clicking on the View link below a category.

View category URL

Display Your Category RSS Feed Links in WordPress

Now that you have located the RSS feed URLs for your categories, let’s take a look at some of the ways that you can share them with visitors on your WordPress website.

1. Add Links to Category RSS Feeds in WordPress

The easiest way to point users to a category RSS feed is by adding a link to the category feed.

You can simply edit a post or page and add a plain text link anywhere you want.

Manually adding link to a category RSS feed in WordPress

You can use this method to manually create a list of links to all your category RSS feeds.

However, what if you add, delete, or merge categories in the future, then you will have to manually update that list.

Wouldn’t it be nice if you can show a dynamic list of category RSS feeds that is automatically updated? Next we’ll show you how to do just that.

2. Manually Display a List of Category Feeds

This next method allows you to display a list of categories with links to the category-specific RSS feed. Best of all, the list will update automatically if you add or remove a category on your site.

For this method, you’ll need to add some custom code to your WordPress website. If you haven’t done this before, then take a look at our guide on how to easily add custom code snippets in WordPress.

First, you need to find an image that you want to use as the RSS feed icon. For this tutorial, we are using the RSS feed icon that is 32×32 pixels in dimensions.

After that, you need to upload that image to your website. Simply go to Media » Add New page to upload your image and then click on the ‘Copy URL to Clipboard’ button.

Copy feed image URL

Now paste this image URL in a plain text editor like Notepad or TextEdit. You’ll need it in the next step.

After that, you need to paste the following code to your theme’s functions.php file or a site-specific plugin.

function wpbeginner_cat_feed_list() { 
$string .=  '<ul>'; 
$string .= wp_list_categories( array(
        'orderby'    => 'name',
        'show_count' => true,
        'feed_image' => '/path/to/feed-image.png'
        'echo' =>
    ) );     
$string .= '</ul>'; 
return $string; 
}
$add_shortcode('wpb-cat-feeds', 'wpbeginner_cat_feed_list' );

You will need to replace the ‘/path/to/feed-image.png’ with the URL of the feed icon image you copied earlier.

Now you can use the [wpb-cat-feeds] shortcode anywhere on your WordPress website to display the list of categories with the RSS feed icon next to each category.

Category list with RSS feed subscription icon

3. Show RSS Feed Subscription Option on Category Pages (Advanced)

Normally, WordPress category archive pages don’t have an option to subscribe. You can easily change that by adding a link to the RSS feed subscription on each category page.

To do that, you’ll need to make changes to your WordPress template files. Simply add the following code to the category.php or archive.php template in your WordPress theme.

<?php                
if ( is_category() ) { 
$category = get_category( get_query_var('cat') );
if ( ! empty( $category ) )
echo '<div class="category-feed"><p><a href="' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe to this category" rel="nofollow">Subscribe</a></p></div>';
}
?>

After you save your changes, you can visit any category page to see the subscribe link in action.

RSS feed subscribe link on category page

Tip: Need help finding out which file to edit in your WordPress theme? See our complete WordPress template hierarchy cheat sheet for beginners to figure this out.

How to Take Advantage of Category RSS Feeds in WordPress

Category RSS feeds allow your users to subscribe only to areas that interest them the most.

For instance, if you have a technology news blog, then your users can choose to subscribe only to news about the devices that they use.

However, a plain RSS feed isn’t readable without a feed reader. And nowadays, most users don’t use a feed reader to subscribe to their favorite websites.

This is where it gets tricky. How do you use your category RSS feeds if your users don’t use feed readers?

Luckily, you can use your category feeds to deliver content to your users anywhere they want.

For instance, you can ask users to sign up for your email newsletter with an option to get updates only for specific categories.

With an email marketing service like Constant Contact, Sendinblue, and others, you can easily set up an automated RSS-to-email newsletter only for specific categories. See our guide on how to notify subscribers of new posts for step-by-step instructions.

Similarly, you can also allow users to get instant push notifications for each category using PushEngage. It is the best push notification service on the market and allows you to send messages directly to your users’ devices (desktop as well as mobile phones).

PushEngage allows you to set up automatic push notifications using RSS feeds. You can simply enter your category RSS feed URL, and a push notification will go out whenever a new post is published in that category.

We hope this article helped you learn how to make separate RSS feed for each category in WordPress. You may also want to see these easy tips to grow your blog traffic or take a look at our comparison of the best live chat software for small business.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Make a Separate RSS Feed for Each Category in WordPress appeared first on WPBeginner.

No comments:

Post a Comment