WordPress comes with built-in taxonomies,
categories and tags,
that allows you to organize your content. Almost every WordPress user
has used categories and tags to sort their content, but most users don’t
know that categories, tags, and custom taxonomies each have their own
RSS feeds (
What is RSS?).
Why is that useful? Well, these topic specific RSS feeds allow your
users to only subscribe to the content they are most interested in. In
this article, we will show you how to allow users to subscribe to
categories in WordPress.
Category Specific RSS Feed in WordPress
By default, WordPress enables topic specific RSS feed for each category, tag, and
custom taxonomy.
Most smart browsers will detect and display the RSS feed URL of the
page. You can access the category specific RSS feed by simply adding
/feed/
to the end of category URL. For example:
http://www.wpbeginner.com/category/wp-tutorials/feed/
Now the easiest way to allow users to subscribe to categories in
WordPress is by letting them know about it. You can add a category RSS
feed link on each category page. You can also also add other
subscription options such as feedly, and bloglines. Last but certainly
not the least, you can allow them to subscribe to category via email.
Let’s look at all of these options in details.
Adding a RSS Subscription Link on Category Pages
Lets start with adding a simple RSS subscription link on category
pages. First thing you need to do is go inside your theme’s folder and
find the file
category.php
. If you don’t see category.php, then look for
archive.php
. If you don’t see either of those, then there is a strong chance that you are using a
WordPress theme framework, and this article will not be as helpful for you.
Now if your theme has a category.php file, then simply add the
following code wherever you want to display the subscription link. We
would recommend adding it right before the loop.
2 | $category = get_category( get_query_var( 'cat' ) ); |
4 | if ( ! empty ( $category ) ) |
6 | 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>' ; |
If your
does not have a category.php file, but it
has an archive.php file, then create a new file called category.php and
paste all the code from archive.php in it. Once you are done, then paste
the above code in it.
By adding the above code, you will be able to see a subscribe link on your category archive page like so:
![Category Subscription Link](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tPJlDWn7dj9sDZyjFtKC7UMKu-wgJ5cQKJcRN7Rkf8-PcuonEzBPywfDcQ2ax7PUHmedKx06rX1ibtCi1Y0PvTy7ZfHilggMWCabV3zdDbz41p-3WlOiF3iAeqkS4mxMbXNuuWhWfz=s0-d)
This code simply adds a link with the anchor text ‘Subscribe’ to the
template. You can get fancy by adding an RSS icon instead of text if you
prefer. All you have to do is replace the “Subscribe” text with an
image URL like so:
An example subscription icon would look like this:
Adding Other Subscription Options for Categories in WordPress
While most users who use a RSS reader already have the browser
extension installed, but it can never hurt to add familiar icons to ease
the process. For the sake of example, we will add buttons for two
popular web based RSS reader apps, Feedly and Bloglines. You can use the
same technique to add other services if you like.
Below is the sample code that you would need to add to your
category.php
file:
02 | $category = get_category( get_query_var( 'cat' ) ); |
04 | if ( ! empty ( $category ) ) |
06 | 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> |
As you can see, we have modified the category feed links for the last
two icons. The first icon still points to your original RSS feed, but
the second and third icon takes the users to Feedly and Bloglines, so
they can subscribe to the category feed. This is how it looked on our
test site:
Adding Email Subscription for Categories in WordPress
When users look at our sidebar subscription option, they think each of those checkboxes are categories. While they are
not categories, the concept of adding category specific subscription is very similar.
![WPBeginner Subscription Checkboxes](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sO_Z82ekJGEAqukfbfLJ62cWVo1x2BxRlT11dafk9xOHXWx8dq5lXIQx-hHa4LCh7V1Ew0NgYe_oARtOJBQspGl7rfqMvL6wloxGJuAg7lbipg-imxX56PYHsgmOCkXm00_i8hB56lNX_umUI=s0-d)
To add email subscription for categories, you would need to utilize a third-party email subscription service like
MailChimp or
Aweber. Both of these companies have a feature called
RSS to Email.
You would need to create a list segment aka groups, and then use those
in combination with RSS to Email feature to accomplish email
subscription for WordPress categories.
We have created already written a guide on how to
create a daily and weekly newsletter
in WordPress which highlights all the same concepts. Please check that
out to learn how to create groups and setup RSS to Email campaign.
The only difference is that you will have to create a RSS to Email
campaign and Groups for each individual category. This is why it is very
important that you are using
categories the right way.
Next, simply copy and paste your form code on your category pages using the same method as the codes above.
There is so much more you can do with your category RSS feeds. See our tutorial on
how to add content in your WordPress RSS feeds and totally manipulate them.
All of these are conducive to helping you stop smoking.
ReplyDeleteThe prerequisite for municipal contracts are permits and performance bonds from the relevant state.
Once family and friends understand that the vapor from
electronic cigarettes doesn't have that infamous smell,
they will be more accepting.
Also visit my site; Hangsen E-Liquid (www.education2020.ca)