• I have a blog that’s pulling RSS feed entries from a different WordPress installation and displaying them on a sidebar. I’d like to randomize the entries in the RSS feed so that they don’t always display in the same order.

    Here’s the current code that’s working, just not in random order:

    <?php include_once(ABSPATH.WPINC.'/rss.php'); // path to include script
    
    $feed = fetch_rss('FEED_URL_HERE'); // specify feed url
    $items = array_slice($feed->items, 0, 10); // specify first and last item
    ?>
    
    <?php if (!empty($items)) : ?>
    <?php foreach ($items as $item) : ?>
    
    <p><a href="<?php echo $item['link']; ?>"><?php echo $item['description']; ?></a></p>
    
    <?php endforeach; ?>
    <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Randomize RSS feed display on sidebar?’ is closed to new replies.