Top

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

July 1, 2010

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

Tweet This Post


Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.