albtechportal

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 27 June 2013

How to Allow Users to Subscribe to Categories in WordPress

Posted on 08:07 by Unknown

How to Allow Users to Subscribe to Categories in WordPress 
 
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.
1<?php
2$category = get_category( get_query_var('cat') );
3 
4if ( ! empty( $category ) )
5 
6echo '<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>';
7?>
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
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:
1<img src="http://example.com/location/to/rss/icon.png" width="48" height="48" alt="Subscribe" />
An example subscription icon would look like this:
Category Subscription Icon

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:
01<?php
02$category = get_category( get_query_var('cat') );
03 
04if ( ! empty( $category ) )
05 
06echo '<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>
07 
08 
09<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>
10 
11 
12<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>
13 
14</p></div>';
15?>
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:
Category Subscription Additional Icons

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
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.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Webdesign, Wordpress | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Review: Seagate 600 480GB SSD
    Seagate Joins the Fray It’s been quite an interesting turn of events over the past couple years in the storage industry. Whereas practical...
  • Top 10 Ways to Customize Your Desktop
    1 Expand You spend a lot of waking hours at your computer, so why not make it a little prettier (and more productive)? Here are 10 ways to...
  • CCBoot - LAN Boot Software for Windows
    LAN Boot Solution Background LAN boot is a technology based on IP (Internet Protocol), UDP (User Datagram Protocol), DHCP (Dynamic ...
  • ‘Strata’ for iOS and Android game review
    There are games that are fun. There are games that look great. And then there are games that do both. Strata is one such game that h...
  • Adobe Photoshop CS6 Extended 13.0 & Plugins + Textures
    Adobe Photoshop CS6 Extended 13.0 & Plugins + Textures | 3.5 GB Adobe Photoshop CS6 Extended software delivers even more imaging magi...
  • Intel NUC DC53427RKE / HYE Review
    Manufacturer: Intel UK Price (as reviewed): £308.32 (inc VAT) US Price (as reviewed): $539.99 (ex TAX) Preferred Partner Price: £308.32...
  • ASUS R9 270X DirectCU II TOP 2 GB
    AMD's new Radeon R9 270X draws its lineage more from the Radeon HD 7800 series than any other. The R9 270X is, for all intents and purp...
  • Corsair Raptor M40 Review
    Manufacturer: Corsair UK price (as reviewed): £44.99 (inc VAT) US price (as reviewed): $59.99 (ex Tax) Along with the Raptor M30, Corsai...
  • Call of Duty: Ghosts Review
    Developer: Infinity Ward Publisher: Activision Platforms: PC, X360, PS3, PS4, Xbox One Price: £39.99 Reviewing a Call of Duty game is a ...
  • How to remotely install apps on your smartphone
    You can download and install apps to your iPhone and Android phone without being anywhere near it. That sorcery is this? It isn't sorce...

Categories

  • Android
  • Apple
  • Audio
  • Blogger
  • C/C++
  • Cabling
  • Cameras
  • Cases
  • CISCO
  • Cooling
  • CPU
  • Desktop
  • DNS
  • Ebook
  • Fiber Optic
  • Gadgets
  • Game
  • Google
  • Graphic Card
  • Hardware
  • HDD
  • HTC
  • HTMLCSS
  • Hyper-V
  • Intel
  • iOS
  • iPad
  • Iphone
  • IT
  • jQuery
  • Laptop
  • Linux
  • Mac
  • MacTut
  • Microsoft
  • Mobile
  • Mouse
  • Networking
  • News
  • Nexus
  • Nokia
  • Nvidia
  • OS
  • PERIPHERALS & COMPONENTS
  • Photoshop
  • Printers
  • Programming
  • Projectors
  • PS4
  • Ram
  • RedHat
  • Review
  • Samsung
  • Scanners
  • Seagate
  • Security
  • Server2008
  • Server2012
  • Servers
  • Smartphone
  • Software
  • Sony
  • Storage
  • Tablets
  • TechNews
  • Template
  • Tutorials
  • TV
  • Ubuntu
  • Voip
  • Webdesign
  • Webiste
  • WebServer
  • Win7
  • Win8
  • Windows Phone
  • Wordpress
  • Workstation
  • XBOX

Blog Archive

  • ▼  2013 (495)
    • ►  December (35)
    • ►  November (332)
    • ►  October (12)
    • ►  September (27)
    • ►  August (2)
    • ►  July (10)
    • ▼  June (42)
      • Six Predictions for Cloud Collaboration in 2013
      • Understanding VLAN Trunk Protocol (VTP)
      • Creating a Mail Server on Ubuntu (Postfix, Courier...
      • Voice Over Internet Protocol (VoIP)
      • Advantages and disadvantages of computers
      • How to make Ubuntu bootable USB
      • Networking Tutorials
      • Why you need a Firewall
      • Online Banking - Essential Security Measures
      • Secure Your PC All about SpyWare
      • Trojan Detection
      • Installing and Testing Wampserver
      • Web Server Tutorial
      • With IE11, Microsoft gets all touchy-feely
      • How to Allow Users to Subscribe to Categories in W...
      • Install Graphical user interface (GUI) in Ubuntu 1...
      • 10 Hand-Picked Tutorials for Beginning Web Designers
      • The Sideswipe Home Screen
      • Top 10 Computer Tricks Every Geek Should Know
      • iPhone 5 tips and tricks
      • Samsung Galaxy S4 Mini review
      • What Is Network Security?
      • Packet-switching
      • Routers and Switches
      • Mixed Networks
      • Fully Switched Networks
      • The Problem: Traffic & Solution
      • Network Topologies
      • How LAN Switches Work
      • Networking Basics: What You Need To Know
      • Sony Xperia Tablet Z Review: Sony Gets It (Mostly)...
      • iOS 7 and its 10 Best Features Explained
      • Xbox One Pricing and Availability Announced
      • How to print directly from the Android phone
      • Choosing a Gaming CPU at 1440p: Adding in Haswell
      • Samsung Makes Galaxy S 4 Active Official - IP67 an...
      • How to set up VPNing on Windows 8
      • How to Change DNS to google public DNS
      • Photoshop Tips: The Brush Tool
      • HTML5 Slider Tutorial Javascript Function Programming
      • Apple Fixes Serious Flaws You Didn't Know About in...
      • Choosing a Gaming CPU
    • ►  May (35)
Powered by Blogger.

About Me

Unknown
View my complete profile