/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
include_once(ABSPATH.WPINC.'/feed.php'); $feed = fetch_feed('http://feeds.feedburner.com/catswhoblog'); $limit = $feed->get_item_quantity(7); // specify number of items $items = $feed->get_items(0, $limit); // create an array of items } if ($limit == 0) echo '<div>The feed is either empty or unavailable.</div>'; else foreach ($items as $item) : ?> <div> <a href="<?php echo $item->get_permalink(); ?>" title="<?php echo $item->get_date('j F Y @ g:i a'); ?>"> <?php echo $item->get_title(); ?> </a> </div> <div> <span>[...]</span> </div> <?php endforeach; ?>
URL: http://www.wprecipes.com/wordpress-tip-fetch-and-display-rss-feeds
Comments
