I am using the built-in rss.php WordPress function by using the following code in a site:
<?php // Get RSS Feed(s) include_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss('http://wordpress.org/development/feed/'); $maxitems = 5; $items = array_slice($rss->items, 0, $maxitems); ?> <ul> <?php if (empty($items)) echo '<li>No items</li>'; else foreach ( $items as $item ) : ?> <li><a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'> <?php echo $item['title']; ?> </a></li> <?php endforeach; ?> </ul>
The problem I have is that when I use the above example (WordPress news feed) it is fine, but when I change it to another WordPress feed (from one of my own sites) it appears once, but when I hit refresh the RSS feed disappears!! It's like it manages to get the feed once, but then doesn't cache it properly or something!!
I'm tearing my hair out trying to work this one out - I just don't understand how this is not working!!