Your SlideShare is downloading. ×
http://simplepie.org/Allows you to get and manipulate RSSfeeds in a simple and standard way
Use the fetch_feed() function to get an RSS feed<?php $feed = fetch_feed( $uri ); ?>http://codex.wordpress.org/Function_Re...
<div class="latestnews"><a href="<?php echo home_url( / ); ?>/“ title="HLS Services Blog"><h2>Latest News</h2></a><ul><?ph...
All classes and methods are documented on theSimplePie website athttp://simplepie.org/api/class-SimplePie.html
Using SimplePie to get an RSS Feed
Using SimplePie to get an RSS Feed
Upcoming SlideShare
Loading in...5
×

Using SimplePie to get an RSS Feed

364

Published on

Using the SimplePie object to get, parse &output an RSS feed in WordPress

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
364
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Using SimplePie to get an RSS Feed"

  1. 1. http://simplepie.org/Allows you to get and manipulate RSSfeeds in a simple and standard way
  2. 2. Use the fetch_feed() function to get an RSS feed<?php $feed = fetch_feed( $uri ); ?>http://codex.wordpress.org/Function_Reference/fetch_feedReturns a SimplePie object.Built in API so you don’t have to use the SimplePie site.
  3. 3. <div class="latestnews"><a href="<?php echo home_url( / ); ?>/“ title="HLS Services Blog"><h2>Latest News</h2></a><ul><?php if(function_exists(fetch_feed)) {include_once(ABSPATH . WPINC . /feed.php); // the file to rss feed generator$feed = fetch_feed(http://feeds.feedburner.com/myfeedname); // specify the rss feed$limit = $feed->get_item_quantity(5); // specify number of items$items = $feed->get_items(0, $limit); // create an array of items}if ($limit == 0) echo <div>The feed is either empty or unavailable.</div>;else foreach ($items as $item) : ?><li><div class="latestnews_textwrap"><h4><a href="<?php echo $item->get_permalink(); ?>" alt="<?php echo $item->get_title(); ?>"><?php echo $item->get_title();?></a></h4><p class="date_posted"><?php echo $item->get_date(l, F j, Y); ?></p></div></li><?php endforeach; ?></ul></div><!-- .latestnews -->
  4. 4. All classes and methods are documented on theSimplePie website athttp://simplepie.org/api/class-SimplePie.html

×