Skip navigation
Wookie
Currently Being Moderated

Reverse order of RSS feed (php)

Aug 6, 2011 1:00 PM

Hi,

I have an rss feed on my site and I would like to reverse the order the posts display. At the moment the latest post is top of the list, but I want the oldest post on top.

 

Can anyone tell me how I can edit my code to achieve this?

 

<?php
include_once(ABSPATH.WPINC.'/feed.php');

$rss = fetch_feed('http://feeds.feedburner.com/myfeed');
$displayitems = $rss->get_item_quantity(5);
$rss_items = $rss->get_items(0, $displayitems);
?>

 

<ul>
  <?php if ($displayitems == 0)
echo '<li>No items.</li>';
else
foreach ( $rss_items as $item ) : ?>

 

<h4><a href='<?php echo $item->get_permalink(); ?>'
title='<?php echo $item->get_title(); ?>'>
<b><?php echo $item->get_title(); ?></b></a></h4>

 

<p>
  <?php endforeach; ?>

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points