We have created the perfect resource to not only help build your website, but also grow it into something special...

How To Display Any RSS Feed On Your Website

December 2009 | Categorized in Site Management

While most people use RSS feeds to stay updated on their favorite website, these feeds are also great way of grabbing content from other sources into your website. Maybe you have multiple sites and want to blend them together or perhaps you want to create a great resource of recommended feeds for your readers.

There are obviously various plugins to easily get the same effect, but if you really want control on how the content is displayed then you’ll want to simply copy and paste the code below to wherever you want it to show.

<?php include_once(ABSPATH.WPINC.'/feed.php');
$rss = fetch_feed('http://feeds.feedburner.com/Webtolerant');
$maxitems = $rss->get_item_quantity(5);
$rss_items = $rss->get_items(0, $maxitems);
?>
<ul>
<?php if ($maxitems == 0) echo '<li>No items.</li>';
else
// Loop through each feed item and display each item as a hyperlink.
foreach ( $rss_items as $item ) : ?>
<li>
<a href='<?php echo $item->get_permalink(); ?>'
title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
<?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>

Remember to change the feed url, quantity, and any other setting  to your own specifications.

blog comments powered by Disqus