WordPress allows users to organize their content with categories, taxonomies and tags. And readers are interested in a class content more than a single post. So if allowing readers to subscribe the categories they are interested in, the website can greatly increase the awareness of old readers. This tutorial introduces the detailed process of allowing users to subscribe to categories in WordPress.
WordPress provides built-in feeds for each category, tag, comment, post, author and even search result. If you want your readers can subscribe to your categories, you can create WordPress category RSS feeds.
Create WordPress Category RSS Feeds
To create a category RSS feed in WordPress, you need to add a cup of code to display the feed link. You can copy and paste the following code in your category.php theme file right before the loop. If you don’t have a category.php file but have an archive.php file, you can create a new file named category.php, and copy the content from archive.php and paste it into the new category.php, then add the following code into it.
<?php $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>'; ?>
Once you added the above code, you are able to see a subscribe link on your category archive page like below.
There is only a simple link with the anchor text “Subscribe” to the template. However, many other sites display the RSS feed with a fresh icon. If you also prefer a RSS icon, you can replace the “Subscribe” text with an icon URL. The code is in the following:
<img src="http://example.com/location/to/rss/icon.png" width="48" height="48" alt="Subscribe" />
At last, you can see your RSS icon like this:
Add Other Subscriptions for Categories in WordPress
Though RSS feed is the most popular subscription, there are many other widely used subscriptions. So you can add more options to allow users feed your content with various subscriptions. We take an example to add buttons for two famous web based RSS reader apps, Feedly and Bloglines. You can use the same method to add other services you like.
To make this process, you need to add the below code into your category.php.
<?php $category = get_category( get_query_var('cat') ); if ( ! empty( $category ) ) echo '<div class="category-feed"><p>Subcribe via: <a href="' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe to this category" rel="nofollow"> <img src="http://example.com/location/to/rss/icon.png" width="32"height="32" alt="Subscribe" /> </a> <a href="http://www.feedly.com/home#subscription/feed/' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe via Feedly" rel="nofollow"> <img src="http://example.com/location/to/feedly/icon.png" width="32" height="32" alt="Subscribe" /> </a> <a href="http://www.bloglines.com/sub/' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe via Bloglines" rel="nofollow"> <img src="http://example.com/location/to/bloglines/icon.png" width="32" height="32" alt="Subscribe" /> </a> </p></div>'; ?>
Just as the above, you can see that we have modified the category feed links for the two new icons. The first icon still points to the original RSS subscription link, but the new two icons bring users to Feedly and Bloglines so that they can subscribe to the category feed. You can look it as the following:
Subscribe WordPress Category with Feedburner
Except the above methods to allow readers subscribe your WordPress category, you can use the professional feed management services like FeedBurner. The operations are also easy to manage, and you can learn from the steps below.
- Get the Slug name of the category by visiting your WordPress dashboard. Go to Categories, you can see the following screenshot.
- Type your category URL in the text editor just like the below format.
Note that the “our-blog” is the slug of your category name.
- Copy the URL and paste it into your Feedburner home screen at the place as following.
- Click the Next button and follow the wizard.
Then, back to your website and use the Feedburner category level RSS feed URL anywhere you like. Or you can use a plugin as Feedburner FeedSmith Extend to manage it.
Subscribe WordPress Category via Email
In addition to the regular feeds, Email subscription is also a major way. Everyone has an email account, and most of them check their email every day. So if you allow readers to subscribe your WordPress categories via Email, you can push the new content to existing readers once you published, and increase the readership.
To add email subscription, you need to use some third party email subscription services like Mailchimp and Aweber which have a feature as RSS to Email. You can create a list segment and groups, and use those in combination with RSS to Email feature. If you use MailChimp, you can follow this article.