I’m using fetch_feed to display an rss feed on a theme i’m working on.
I think the documentation implies that you can combine multiple feeds, can anyone confirm this, ideally with an example.
Thanks in advance!
George
I’m using fetch_feed to display an rss feed on a theme i’m working on.
I think the documentation implies that you can combine multiple feeds, can anyone confirm this, ideally with an example.
Thanks in advance!
George
You must be logged in to post a comment.
You can technically pass multiple feed URLs to fetch_feed() as an array, and it’ll grab them all at once. But the return is a total mess, and I couldn’t personally figure out how to parse it.
If nobody else knows how to do this with fetch_feed(), I can offer a solution using the SimplePie class (which fetch_feed actually uses anyway). The SimplePie class has some helper methods for parsing the return, and they make things pretty easy.Try something like:
Additional SimplePie methods include get_permalink() and get_description().
The only downside to this approach is that is SimplePie is ever phased out of WordPress in favor of another class, this’ll break.
UPDATE
As @Rarst pointed out in the comments, you don’t need to access SimplePie directly. You can use its methods on the object that fetch_feed() returns. So the answer is much simpler than I thought: