Publishing External RSS Headlines to Your WordPress Site

I wouldn’t advise republishing content from any old RSS feed, but sometimes there’s a reason.

Let’s say in addition to DarrenHoyt.com, I also owned DarrensMusicNews.com, and I wanted to display those headlines in this blog’s sidebar. There are plugins to accomplish this, and sweet RSS/XML parsers like SimplePie, but WordPress already comes with a function to handle it — this can be seen on your WP dashboard page where headlines are pulled from the Planet WordPress feed.

That dashboard code lives in /wp-admin/index-extra.php, which is where I took fragments and rewrote it to a simpler snippet:

<?php
require_once (ABSPATH . WPINC . '/rss.php');
// insert the feed URL here
$rss = @fetch_rss('http://www.darrensmusicnews.com/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>

<?php } ?>

Give it a try. The code is mainly valuable for interlinking multiple sites you may own (check out the “Recently on the GigaOM Network” module in the footer of GigaOm.com. That can also be accomplished with the BlogNetworking plugin).

If you do decide to parse/publish someone else’s blog feed, it’s best to get permission first and give proper credit, and don’t just do it for crummy advertising dollars :P