Randomize wordpress posts order

February 3, 2009 · Print This Article

Are you building a portfolio or a gallery with WordPress? If yes, it can be a good thing to randomize posts order, that’s very easy to do with WordPress.

To randomize posts order, you’ll have to use the very powerful query_posts() function before your WordPress loop:

query_posts('orderby=rand');
//Your loop goes here

Of course, it is also possible to randomize only a certain category:

query_posts('cat=8&orderby=rand');
//Your loop goes here


Your choice for site templates and wordpress themes

Comments

One Response to “Randomize wordpress posts order”

  1. nicuuul on May 13th, 2011 10:32 pm

    There is a nice plug-in which allow posts order and pages called Post Types Order

Got something to say?

You must be logged in to post a comment.