Display Headlines From an RSS Feed on Your WordPress Blog

If you’ve ever wanted to put a list of the headlines from an RSS feed, perhaps that of another blog of your’s, somewhere on a WordPress site, there’s no need to resort to a plugin or some external script.

WordPress includes the functions to create a simple list of RSS headlines right in the core. The wp_rss function is used in places like the Dashboard, and in the RSS widgets.

<?php include_once(ABSPATH . WPINC . '/rss.php');
wp_rss('http://feeds2.feedburner.com/Webmaster-source', 5); ?>

I found this gem over at WP Recipes. Quite useful for basic stuff.

I recently had a look through Yoast’s cross-referencing of the WordPress Trunk, and it seems that the function uses the legacy MagpieRSS to parse the feeds. If you want more control over your feed parsing, you may want to use the included SimplePie class. It’s already loaded up by WordPress. All you have to do is invoke it by instantiating the class, which you can learn how to do here.

  • http://ineeddiscipline.com/2008/07/04/19-blog-review-networks/ Dean Saliba

    I'm currently working on a blog for a friend who wanted a section on his sidebar for healdines from another web site that is related to his blog niche.

    I think this piece of code might be just for I need.