Permalink
Browse files

Adding RSS code

  • Loading branch information...
1 parent 5538a47 commit 541fc4abda870f1c469c0986c6aca9ebc09471c2 @amberweinberg committed Jan 12, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 rss.php
View
13 rss.php
@@ -0,0 +1,13 @@
+<?php // Get RSS Feed(s)
+ include_once(ABSPATH . WPINC . '/feed.php');
+
+ // Get a SimplePie feed object from the specified feed source.
+ $rss = fetch_feed('/feeds');
+ if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly
+ // Figure out how many total items there are, but limit it to 5.
+ $maxitems = $rss->get_item_quantity(20);
+
+ // Build an array of all the items, starting with element 0 (first element).
+ $rss_items = $rss->get_items(0, $maxitems);
+ endif;
+ ?>

0 comments on commit 541fc4a

Please sign in to comment.