Wordpress – Random post order

241 views Asked by At

I want to have a random post order, but it does not work: The order of the posts is still by date. Can you help me?

http://inge.timrodenbroeker.de

<!-- T H E   L O O P -->  


<?php query_posts(array('post_type' => 'post', 'orderby' => 'rand', 'posts_per_page' => -1)); ?>
<?php if ( have_posts() ): $i = 0;  ?>

<?php while ( have_posts() ) : the_post(); $i++; ?>

<div class="article-content <?php if ($i % 7 == 0) echo 'seventhclass'?>" id="post-<?php the_ID(); ?>">

<div class="article-thumb">

<?php the_content(); ?>


<!-- Close article-thumb -->
    </div>

<!-- Close article-content -->

</div>

<?php endwhile; ?>


 <!-- /T H E   L O O P -->  
1

There are 1 answers

1
MilanG On

Hmm...if you check documentation for that function:

https://codex.wordpress.org/Function_Reference/query_posts

you'll see that it's not recomended using it from pluging / themes, but they are suggesting alternative methods.