• Hello every one,
    i allways use the orderby=rand in all my themes, but recently with my last website, the orderby=rand wont to work, and it show only the latest article, see the link in the bottom of the home page : clique her

    this is the code i use :

    <?php
    	query_posts('showposts=1&category_name=voiture&orderby=rand');
    	if (have_posts()) : while (have_posts()) : the_post();
    ?>
    	<img src="img.jpg"/>
    	<div>
    		Type de voiture : Tourisme
    		Marque de voiture : Fiat
    		Model de voiture : PANDA
    		<a href="#">Réservation en ligne</a>
    	</div>
    <?php endwhile; else : ?>
    <?php endif; wp_reset_query();?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter taghaboy

    (@taghaboy)

    any idea pls,
    just for information, there any other loop in the index or home page, yes it’s strange, but the loop with the order by rand dont work!
    i’m open to any idea.
    thanks

    Guess you should use 'order=RAND' instead of 'orderby=RAND'

    Orderby is the field you wish to order by, eg. date, ID or whatever…

    Thread Starter taghaboy

    (@taghaboy)

    thanks for your reply,
    i use it but still not work.
    Really strong.

    before the query right following
    remove_all_filters(‘posts_orderby’);

    Thread Starter taghaboy

    (@taghaboy)

    thanks for your reply
    i’d like to know what the “remove_all_filters” do?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘orderby=rand dont work, any help pls’ is closed to new replies.