WordPress.org

Ready to get started?Download WordPress

Forums

Random/Rotating Post through The Loop? (3 posts)

  1. SpencerLavery
    Member
    Posted 7 years ago #

    Hi guys,

    I've finally managed to figure out Multiple Loops and get different Categories displaying with different formatting on the Index page.

    Now what I would like to do is randomise the display of posts for one specific category. Currently the loops I'm using is:

    <?php query_posts('category_name=releases&showposts=3'); ?>
    <?php while (have_posts()) : the_post(); ?>
    // write post according to formatting
    <?php endwhile; ?>

    I've downloaded the Random-Posts plugin but I've tried to no avail to get it to work with this loop.

    The key thing is - they don't necessarily need to display randomly, just so long as they change slightly upon refresh.

    Any ideas?

  2. jonez
    Member
    Posted 6 years ago #

    Random-Posts generates a list of posts, and works outside the loop. I'm also searching for something to randomize the loop proper, but if you just want different, try randomizing the post offset.

    I've also found this thread ( http://wordpress.org/support/topic/125739?replies=9 ) which talks about the php shuffle function.

  3. SpencerLavery
    Member
    Posted 6 years ago #

    Thanks I'll take a look :)

Topic Closed

This topic has been closed to new replies.

About this Topic