Google it! / Yahoo it! / Bing it! / Ask it!

First of all you need the Simplepie library. You only need the simplepie.inc file included in the archive.
My example extracts 5 items from a recipe blog:
<div class="block">
<h2>Latest Culinary Recipes</h2>
<div class="content">
<?php $feed = new SimplePie('http://www.wordpress-site.com/feed');?>
<ul>
<?php foreach ($feed->get_items(0, 5) as $item): ?>
<li>» <a href="<?php print $item->get_permalink();?>"><?php print substr(($item->get_title()),0,23);?> [...]</a></li>
<?php endforeach; ?>
</ul>
</div>
</div>
I have also included a substr() function to show only the first 23 characters in the title. It fitted my web site better.
Don’t forget to have the simplepie library included at the top:
include('includes/simplepie.inc');


Loading ...