WordPress and SimplePie functionality

SimplePie functionality for your blog:
function fetch_feed_modified($url) {
 require_onceĀ  (ABSPATH . WPINC . '/class-feed.php');
 $feed = new SimplePie();
 $feed->set_feed_url($url);
 $feed->set_cache_class('WP_Feed_Cache');
 $feed->set_file_class('WP_SimplePie_File');
 $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200));
 $feed->init();
 $feed->handle_content_type();

 if ( $feed->error() )
 printf ('There was an error while connecting to Feed server, please, try again!');

 foreach ($feed->get_items() as $item){
  printf('<li><a href="%s">%s</a>',$item->get_permalink(), $item->get_title());
 printf(' <small>%s</small></li>',$item->get_date());
 }
}

function ms_smallpie_feed($uri) {
 if(function_exists('fetch_feed_modified')) {
 fetch_feed_modified($uri);
 }
}

Continue reading "WordPress and SimplePie functionality"