There are many plugins that allow you to display any RSS feed on your WordPress blog in one way or another, but did you know that WordPress itself has a built-in RSS reader?

That’s right, a couple of lines of code will add the WordPress function called wp_rss() to your blog which is nothing more than that built-in RSS reader.

The Fix

The code below can be added anywhere in your theme. The most suggested places however are the sidebar, the footer or the page template:

<?php include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('', 5); ?>

Once you’ve added the code above to the location of your choice, save it, and you’re done.

How It Works

What the code in question does is basically include the rss.php file from WordPress core.  What this file does is it allows you to use the wp_rss() function I mentioned earlier.

This function takes two parameters:

  1. The RSS feed’s URL – in this case
  2. The number of RSS entries you want to be displayed – in this case it’s 5 feed items.

You can change these to whatever RSS feed and value you’d like. It’s as simple as that.

Source: WP Recipes

Published by Mark Zahra

The Team Lead and Head of Support for the WP RSS Aggregator project, which forms part of the RebelCode family.

Leave a Reply

Your email address will not be published. Required fields are marked *