Embed RSS Feeds in WordPress

WordPress makes it easy (well, kind of) to embed RSS feeds into your WordPress template, so you can have a feed displayed in your sidebar, footer, or anywhere else you want in your PHP files. To do this, I used a combination of code from Darren Hoyt and Jeriko.

first, from Darren

require_once (ABSPATH . WPINC . '/rss.php');
$rss = @fetch_rss('RSS FEED HERE');
if ( isset($rss->items) && 0 != count($rss->items) ) {
$rss->items = array_slice($rss->items, 0, NUMBER OF ITEMS);
foreach ($rss->items as $item ) {

and then the bit from Jeriko

<a href='<?php echo wp_filter_kses($item['link']); ?>'>
  <?php echo wp_specialchars($item['title']); ?>
<?php } ?>
<?php } ?>

Enjoy the post? Encourage me by subscribing to the feed, following me on Twitter, and becoming a fan on Facebook. Cheers!