How to Create Custom RSS Feeds in WordPress

With the abundance of news pieces and the number of blog sites continuously growing, keeping track of what’s coming round can be tiring. Fortunately, there is such a standard as RSS that makes it super easy. It provides a simple yet an effective way to keep up with the latest news and what matters to you most. In other words, RSS grabs content from a particular website and aggregates it into a news reader application.

When implemented well, this automation solution saves readers time greatly. Really Simple Syndication monitors the websites that you’re interested in and synchronises all their new content updates as they come out. It takes the daunting search routine on its part, leaving you the time just to glimpse and enjoy the latest.  

You can use these feeds in a number of ways. For very basic implementation, WordPress has its built-in default RSS feeds. But there are also more specialized purposes for delivering a more specific type of content, for which you may need to create a custom RSS. In this article, we’ll show you how to do this.

Please note that this tutorial is not targeted for beginner level of WordPress users.

As always, before making any major changes to a live website, remember to complete your WordPress website backup.

The first thing you need to do is initialize your custom RSS action in your theme’s functions.php file.

The function above adds the feed to the template through the add_feed function. The add_feed function has two arguments, feedname, and a callback function. The feedname will make up your new feed URL http://ift.tt/1eAs9CP, and the callback function will be called to actually create the feed. So, we need to create the myRSSFeed function in theme’s functions.php file.

You can place the RSS code directly in the callback function. By using get_template_path, we can keep the functionality separate to the layout.

The get_template_path function takes the slug and name arguments to a template file like wp-content/themes/themename/slug-name.php or wp-content/themes/themename/slug.php.

Take a look on the template file.

The final thing that is left to do is flush your WordPress rewrite rules. To proceed with this action easily, you need to log in to the WordPress admin panel, and go Settings -> Permalinks. Once there, just click Save Changes, this will flush the rewrite rules. Now you can access your feed at http://ift.tt/1eAs9CP.

The last thing to mention is that you can aggregate as many RSS feeds from as many sources as you’d like if you apply some ingenuity. The easiest way to do so is to make a use of WP RSS Aggregator. It is a very neat plugin for importing, merging and displaying RSS and Atom feeds on your WordPress site. This solution is very comprehensive and elegant for WordPress, so it does not take much effort and time to get started.

About Julia Nimchynska

Marketing manager at CMS2CMS, a travel lover, simplicity enthusiast, a fan of jazz and yoga.

Let's block ads! (Why?)


SHARE

Unknown

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment

0 comments:

Post a Comment