How to add any RSS feed to your WordPress blog

How to add any RSS feed to your WordPress blog

Have you seen blogs where different types of RSS feeds are displayed on pages and blog posts? If you have installed WordPress out of the box, the only way that you can add RSS feeds to your theme is usually via the “RSS” feed widget but then it is only displayed on a widget ready area on your theme.  If you would like to add any “RSS” feed to your theme, there’s a couple of ways this can be accomplished.

  • Install a plugin
  • Create a “template” file with custom RSS code
  • Edit or create a new widget ready area on your theme

Install the RSS in Page plugin

This is by far the easiest way to add custom “RSS” feeds on your blog posts and pages.  Currently, I’m using the plugin “RSS in Page” on this blog to display a custom RSS feed I have created about my “Social Stream” that contains tweets from my Twitter account, My Chatbox profile and this blog.

Once you have installed the plugin, you can add the below code to any page or blog post to display the “RSS” feed.

{code type=php}

{/code}

Replace “http://yourfeed.com” with the RSS feed you would like to add and change “rssitems” to the number of items you would like to display.

Create an RSS template file

In my previous post about WordPress, I explained how you can create your own custom template files.  Using that method, create a template and add the following code to that template page.

{code type=PHP}
include_once(ABSPATH.WPINC.’/rss.php’); // path to include script
$feed = fetch_rss(‘http://www.yourfeed.com/’);
$items = array_slice($feed->items, 0, 25); // specify first and last item
?>

 

Date:




{/code}

Replace “http://yourfeed.com” with the address of your feed.

Widget ready areas

If you would like to add more widget areas to your theme where you can drag and drop the RSS widget from the dashboard directly onto the widget area, have a look at this page on widgetizing your theme – Widgetizing Themes.

The methods explained above is an excellent way that you can basically add any RSS feed to your WordPress posts or Pages ranging from YouTube RSS feeds, blog feeds, Twitter Statuses, etc.

 

About: Anton Koekemoer

Anton is a social media strategist, digital marketing consultant, and an online reputation management specialist with an emphasis on Web 2.0 technologies. He is passionate about digital marketing and as a social media strategist enjoys designing and implementing strategic plans and business systems around Web 2.0 technologies.