February 10, 2012

Revisiting parsing a feed

A while back we had a guest post from WordPress Modder on how to parse (display) a feed anywhere in a template. Since then, WP & WPMU 2.7 have rolled in a new function to handle this with a lot less code.

Just put the following anywhere in the template:
<?php include_once(ABSPATH . WPINC . '/rss.php');
wp_rss('http://example.com/rss/feed/goes/here', 5); ?>

Replace the example URL with the URL of the feed, and the 5 with how many titles you want to show.

Or, if you want to get really fancy, you could adapt my Build a Widget, toss this code in there with your sitewide feed and let any user display the latest sitewide posts (from the sitewide feed) in their sidebar.

(Yes, you can use the RSS widget to do the same thing, but most users don’t know how to use it. )

HT: WP hacks

Get 3 for the price of 2 in the Network Home Bundle

Includes 3 ebooks with plugins -
Network Home Pages: aggregate global content, set up sitewide tags, create a huge tags cloud like the one seen on WordPress.com, global footers and menus, setting defaults & more
Custom Registration: sign up on sub sites, multilingual signup pages, stop spam blogs
WP Curator: pick and choose posts from sub sites to feature on the main home page of your network

Network Home Pages, Custom Registration & WP Curator – $35.90 for all three. Purchase