0 Replies Latest reply: Aug 6, 2011 1:00 PM by Wookie RSS

    Reverse order of RSS feed (php)

    Wookie Community Member

      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; ?>