Articles of simplepie

Getting Post Thumbnail from RSS feed with SimplePie

I am trying to pull the post thumbnail from an RSS feed to output on an external site. I am using the following function to add the post thumbnail to the site: function rss_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = ‘<p>’ . get_the_post_thumbnail($post->ID, ‘be_home’) . ‘</p>’ . get_the_content(); } return $content; } add_filter(‘the_excerpt_rss’, ‘rss_post_thumbnail’); […]

How to prepare SimplePie_Item's get_date() for l10n?

I’m trying to improve the localization of the Bones theme. On the admin side it provides an RSS widget which uses the following code: <?php echo $item->get_date(‘j F Y @ g:i a’); ?> This uses SimplePie, here’s the doc for the method. Which would be the best way to make this translatable?

How to get more than 25 items via Simplepie RSS Feeds?

I have a feed with 50 items but seemingly no matter what I do, it always returns just 25. $feed->set_item_limit(50); or $rss_items = $rss->get_items(0,50); none of these have any effect nor do I see any reference to the number 25 in the class source, I don’t get it. The feed is http://gdata.youtube.com/feeds/base/users/silviavaldemoros/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile&max-results=50

fetch_feed: retrieve entries in the appearing order, not chronologically

I’m using WP function fetch_feed to retrieve a feed and display its items. <?php /* include the required file */ include_once(ABSPATH . WPINC . ‘/feed.php’); /* specify the source feed */ $rss = fetch_feed(‘FEED_URL’); /* checks obj. is created */ if (!is_wp_error( $rss ) ) : /* specify number of items */ $maxitems = $rss->get_item_quantity(4); […]

Troubleshooting fetch_feed and SimplePie

I’ve got a very basic solution using fetch_feed() and SimplePie to pull in RSS items which is working on my localhost, but for some reason is_wp_error() persists as true on the live server. Is there anyway for me to get specific output about the nature of the error so as to work towards a solution […]

WordPress SimplePie modifications

I am using the fetch_feed() function provided in WordPress to build a SimplePie feed object. The code from WP is the following: function fetch_feed($url) { require_once (ABSPATH . WPINC . ‘/class-feed.php’); $feed = new SimplePie(); $feed->set_sanitize_class( ‘WP_SimplePie_Sanitize_KSES’ ); // We must manually overwrite $feed->sanitize because SimplePie’s // constructor sets it before we have a chance […]

Why does Simplepie return feed items in a wrong order?

I have this feed from picasa (correct but arbitrary, desired order). The result is messed up Also, with this feed, for example. It’s fine in regular, sorted by date feeds, but not these. In the object I get from Simplepie it has a messed up order. I don’t do anything fancy just loop over the […]

How to use cache with simplepie

According to the docs, if you want to cache results for a fetch of RSS feeds with simplepie, you do this: add_filter( ‘wp_feed_cache_transient_lifetime’ , ‘return_7200’ ); $feed = fetch_feed( $feed_url ); remove_filter( ‘wp_feed_cache_transient_lifetime’ , ‘return_7200’ ); My question is if I want to cache the results for several feed urls (by looping through an array), […]