WordPress Snippets at WPcustoms

List your friends feeds on your own site

I quickly wrote this function to list other sites’ feeds. Simply copy the snippet in your themes functions.php and use the functionname with the feed url as an argument in your theme files.


/**
 * Snippet Name: List your friends feeds on your own site
 * Snippet URL: https://wpcustoms.net/snippets/list-friends-feeds-site/
 */
  // usage:  wpc_list_rss_feed('http://wordpress.org/plugins/rss/browse/new/');

function wpc_list_rss_feed($feedurl) {
    include_once(ABSPATH.WPINC.'/rss.php'); $feed = fetch_rss($feedurl);
    $items = array_slice($feed->items, 0, 5);
       if (!empty($items)) :
        echo '';
       endif;
}