First question posted so sorry in advance if this has already been covered and I just couldn't find the answer.
I'm using SimplePie 1.2.1 to display an Atom feed of a client's Facebook wall on their corporate web page. It seems to work pretty well except that the latest entry SimplePie displays is from nearly a month ago.
When I test the feed URL in a browser, everything is up-to-date so there doesn't seem to be any problem with the feed.
Can anyone verify that the code below should indeed display the 3 latest posts? Am I overlooking something obvious?
In the Head:
// Make sure SimplePie is included. You may need to change this to match the location of simplepie.inc.
require_once('inc/simplepie.inc');
// We'll process this feed with all of the default options.
$feed = new SimplePie();
// Set the feed to process.
$feed->set_feed_url('http://www.facebook.com/feeds/page.php?format=atom10&id=160652600629357');
// Run SimplePie.
$feed->init();
$feed->handle_content_type();
In the body:
<?php
foreach ($feed->get_items(0,3) as $item):
?>
<div class="item">
<h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
<p><?php echo $item->get_description(); ?></p>
<p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
</div>
<?php endforeach; ?>