How To Set Up RSS Feeds In WordPress

How To Set Up RSS Feeds In WordPress

WordPress started as a blogging service and gradually evolved into a complete web development platform. It powers more than a third of the world’s websites and liked for its user-friendly features. People flood forums with inquiries like convert my website to WordPress in order to migrate to the platform and enjoy the advantages it offers. The CMS still remains a popular blogging platform and provides various conveniences to content publishers. One such beneficial feature is RSS feed which most bloggers will be familiar with. Amateurs would have seen its icon alongside written content but would not know about what it is or how to set up RSS feeds in WordPress.

In this article, we will tell you about RSS feeds and their benefits. We will also provide information about how these features can be set up in a WordPress interface.

What Is RSS?

RSS stands for Really Simple Syndication or Rich Site Summary lets users access content from their favorite online sources easily. Once the RSS of a website is subscribed, its fresh content automatically appears in the user’s RSS reader or mailbox. It uses different web feed formats to publish content in a structured XML file which is called the RSS feed. The XML file ensures that the syndicated content is compatible with all programs and machines. 

Automatic syndication helps readers receive updates about their favorite content without needing to visit the websites. They can opt for receiving the feed in their email or access it through desktop or web-based feed readers.

What Are The Benefits Of Using RSS Feeds?

RSS feeds are helpful for people accessing content from a variety of sources. They can get updates about written content such as news items, articles, blogs etc. The feature can also be used to know about favorite audio and video content updates. Most blogs provide updates to subscribers through emails but users will have to spend time reading separate emails. An RSS reader solves the problem by syndicating all the content at one place.

As mentioned earlier, the XML file makes sure that there are no compatibility issues. The feeds can be accessed on all sorts of devices and programs. RSS readers extract the text or images from a content and display them. Readers also have the facility for filtering their feed and personalize it.

These advantageous features of the service make it essential that bloggers and website owners provide the convenience on their interfaces. It allows them to build a subscriber base and improve the conversion rate of their website. 

How RSS Feeds Can Be Set Up in WordPress?

Automatic generation of an RSS feed is a default feature in WordPress. An owner has to know how to set up RSS feeds in WordPress though, to customize it according to his/her requirements. Optimizing the feeds is essential for ensuring that the potential of the content for attracting readers is exploited fully. There are two ways to set up the feeds in WordPress- by using plugins or manually.

Amateurs can take help of plugins to set up a custom RSS feed for their website. People with good technical knowledge can use the manual method being provided here. Let’s take a look at it:

Creating A Custom RSS Feed 

Before starting this process, users as a precaution must take a complete backup of their website. In the example given here, an RSS feed with the following elements is being created:

  • Title
  • Author
  • Date of publishing
  • Link
  • ExcerptStep

1: Create The New Feed In Theme’s functions.php file

The first step is to create the feed in the functions.php file of your theme.

add_action('init', 'customRSS');

function customRSS(){        

add_feed('feedname', 'customRSSFunc');

}

This code will initiate the customRSS function which is responsible for adding the RSS feed. See the next line where two arguments are present for the add_feed function. The “feedname” will make the new feed URL while the callback function“'customRSSFunc” will be called to create the feed. Replace ”feedname” with a term of your choice. 

Step 2: Create The Callback Function For Generating The New Feed

After the feed has been initialized the callback function for generating the new feed needs to be created.

function customRSSFunc(){        

get_template_part('rss', 'feedname');

}

Insert the above code in the functions.php file of the theme. We have used “get_template_part” function to link to a separate template file. This has been done to ensure that functionality is separate from the layout. Users can include the RSS code directly into the function if they wish to do so. 

The get_template_part function with two arguments- slug and name, will search for a template file in the following formats:

wp-content/themes/child/rss-feedname.php

wp-content/themes/parent/rss-feedname.php

wp-content/themes/child/rss.php

wp-content/themes/parent/rss.php

Step 3: Creating The Feed Template

As mentioned earlier, we now need to create the template file of the feed. 

The above code will generate the layout for our RSS feed with the five elements that we wanted. This file must be saved in the theme folder. Name it as slug-name.php configured in the “get_template_part” function.

You can control the number of posts that will be displayed in the feed. The postCount variable allows you to do that. the_excerpt_rss will display the excerpt of each post. In case there are no excerpts, it will display the first 120 words of the content.

Final Step: Flush WordPress Rewrite Rules

In order to display the RSS feed, you will have to flush the rewrite rules of your WordPress installation. Access the admin dashboard and go to Settings> Permalinks. 

Click on the “Save Changes” button which will flush the rewrite rules. The new feed can be accessed now at yourdomain.com/feed/feedname. The feedname will be the term you chose in the first step.

Wrapping It Up 

This was the manual process to set up RSS feeds in WordPress websites. People with technical knowledge will not encounter many difficulties in using this method. Introducing the feature will help website owners in attracting new visitors to their interface and expanding their subscriber base. 

About Author: Brandon Graves is a WordPress expert working as an WordPress Expert with HireWPGeeks – convert html css to wordpress services provider. He is passionate about writing useful updates for WordPress users. Follow him on Google Plus to get instant updates from him.

richardmsmith 5 years ago
Thanks for sharing information I must say very informative blog post. Keep it up!!

Leave a Reply