[resolved] Random post order (4 posts)

  1. pshero
    Posted 7 years ago #

    Hey Gang!
    I just need a bit of PHP help. On my site PSHERO.com I'd like to be able to randomize the order in which posts are displayed. That way visitors to my homepage will be presented with lessons that maybe they haven't seen before. I'm crap at writing my own PHP and have searched all over for a code snippet that would do the trick but to no avail. I'm sure this isn't rocket science, all I want to do is randomize the posts.

    Thanks in advance!

  2. stvwlf
    Posted 7 years ago #


    I've not tried this myself but give it a shot.

    In your index.php, add this before the WP loop

    <?php query_posts($query_string . '&orderby=rand') ?>

  3. pshero
    Posted 7 years ago #

    STVWLF, Thanks a million, that did the trick perfectly!

  4. staceyk18
    Posted 7 years ago #

    Fantastic! Been searching for this everywhere!!! :)

Topic Closed

This topic has been closed to new replies.

About this Topic