I need to display 2 different feeds rss with WordPress. I’m using this code:
$feed = fetch_feed(array('http://somewhere.rss', 'http://anotherplace.rss'));
// Loop the results
foreach($feed->get_items() as $item) {
echo $item->get_title();
}
it works fine but the problem is how to separate the sources. It returns a big list with 2 sources data joined. How can I know what are the data from the first url and the second? The API on WordPress’ website is not clear about that.
Any idea?
Thanks
Randomize
According to the WordPress Codex documentation, the
fetch_feedfunction uses SimplePie. When you iterate over the items, each item is an instance of SimplePie_Item. So you should be able to use theget_feedmethod, such as: