Parsing multiple feeds by fetch_rss
-
Hi
I need to parse multiple feeds by fetch_rss function. Feeds get from link_rss column in wp_links table. Code that I write here:include_once(ABSPATH . WPINC . '/rss.php'); function rss_fetching (){ global $wpdb; $feeds_url = $wpdb->get_col("SELECT link_rss FROM $wpdb->links"); foreach ($feeds_url as $url){ $rss = fetch_rss($url); $maxitems = 1; //Number of display items in each feed $items = array_slice($rss->items, 0, $maxitems); echo '<ul>'; if (empty($items)){ echo '<li>No items</li>'; } else { foreach ( $items as $item ) { echo "<li><a href=\"".$item['link']."\" title=\"".$item['description']."\">".$item['title']."</a></li>"; } } echo '</ul>'; } }
First Q:
This code work exactly but decrease page loading speed! Fetching feeds repeat in each refresh. I know fetch_rss is related with MagpieRSS class. How I can use RSSCache of this class to remove fetching repeat?! Or maybe my code is wrong! because with one feed it
Work correctly and maybe used cash system of this class!Second Q:
How I can get items date?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Parsing multiple feeds by fetch_rss’ is closed to new replies.