I'm trying to import a feed from a WordPress site to another using fetch_feed()
.
All is good except for the fact I can get only the first item of the feed.
Here's the code I'm using
add_shortcode('custom_feed','feed2');
function feed2(){
$rss = fetch_feed( 'http://blog.sugarpulp.it/feed/' );
$rss_items = $rss->get_items( 0, 3 );
foreach ( $rss_items as $item) {
$title = $item->get_title();
return $title;
}
}
Hope can help me out. This thing is driving me crazy!