Daily Tip: How to Embed RSS Feed Entries in WordPress Posts

July 1, 2010  | 
7 Comments

If you want to list some of the latest posts from another site within one of your WordPress posts or pages, here’s a handy way to do it using a shortcode. First, add this to your functions.php file:

//This file is needed to be able to use the wp_rss() function.
>include_once(ABSPATH.WPINC.'/rss.php');
function readRss($atts) {
    extract(shortcode_atts(array(
	"feed" => 'http://',
      "num" => '1',
    ), $atts));
    return wp_rss($feed, $num);
}
add_shortcode('rss', 'readRss');

After adding that you can now use a shortcode to embed RSS:

[rss feed="http://wpmu.org/feed" num="5"]

It will look a little something like this:

Source: CatsWhoCode.com

Featured Plugin - Start Your Own Powerful Membership Site

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - Send beautiful html email newsletters, from WordPress!

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Featured Plugin - Every great SEO tweak you need, in one snazzy bundle

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Featured Plugin - Open an Online Store with MarketPress

Out of all the WordPress ecommerce plugins available, this has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - Turn any WordPress page into a fully featured wiki!

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - Easily integrate your WordPress site with Facebook

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

Featured Plugin - Start your own Quora / StackOverflow / Yahoo Q&A site

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - WordPress + Google Maps = Perfect

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

Featured Plugin - Host sites, get paid, just like WordPress.com

If you've ever wondered how you could offer a paid site management and hosting service, then this is the plugin for you. Offer a freemium or paid service, for any niche you like, it's powered Edublogs.org to success already!
Find out more

7 Responses to Daily Tip: How to Embed RSS Feed Entries in WordPress Posts

  1. Hiya,

    thats a great tip, but the feed always seems to be at the top of the post, is there a way of changing this?

    http://music-movement.com/blog/2010/05/19/aryn-michelle/

    cheers

  2. Pingback: How to Embed RSS Feed Entries in WordPress Posts

  3. We do something similar. The only real difference though is we include a check to make sure the enduser isn’t pulling in their own RSS feed. As noted earlier, that may cause an issue.

  4. Pingback: How to Embed RSS Feed Entries in WordPress Posts

  5. I’d been trying to find something to embed the category RSS feeds from my WordPress website into pages of the website, so when I saw your post, I was excited. But when I tried it (copied your code verbatim to the bottom of the functions.php file) and added that one line of code to the bottom of one of my pages, I got this:

    //This file is needed to be able to use the wp_rss() function. include_once(ABSPATH.WPINC.’/rss.php’); function readRss($atts) { extract(shortcode_atts(array( “feed” => ‘http://’, “num” => ’1′, ), $atts)); return wp_rss($feed, $num); } add_shortcode(‘rss’, ‘readRss’);
    Warning: Cannot modify header information – headers already sent by (output started at /home/raider10/public_html/wp-content/themes/voodoo-dolly/functions.php:51) in /home/raider10/public_html/wp-includes/pluggable.php on line 890

    What am I missing?

  6. Never mind — I got it to work. But the same question — how do I get it somewhere else on the page other than the top?

  7. I am receiving the same error as Chris. What did he do to correct this? I guess I’ll have to mess with it a bit more. I already know how to add an rss feed to a page but it appears that this will allow me to add to a post, which is precisely what I want to do.

Click on a tab to select how you'd like to leave your comment

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting