RSS Feed won't display…
-
Guys –
Trying to display an external RSS feed on one of my pages (not in a sidebar – on a main page). I paste the code shown below in the HTML section of the page but the feed won’t display – instead the page truncates the code and displays that instead of the feed.
Should i be using something different, or placing the code in a different place? I just want it to show the feed on one of my pages…
Thanks!
Here’s a sample of the code I’m using:
<?php if(function_exists('fetch_feed')) { include_once(ABSPATH . WPINC . '/feed.php'); // include the required file $feed = fetch_feed('http://feeds.kaiserhealthnews.org/topics/insurance/'); // specify the source feed $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> <?php echo substr($item->get_description(), 0, 200); ?> <span>[...]</span> </div> <?php endforeach; ?>
- The topic ‘RSS Feed won't display…’ is closed to new replies.