WordPress.org

Ready to get started?Download WordPress

Forums

orderby=rand dont work, any help pls (6 posts)

  1. taghaboy
    Member
    Posted 2 years ago #

    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();?>
  2. taghaboy
    Member
    Posted 2 years ago #

    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

  3. Steffen Jørgensen
    Member
    Posted 2 years ago #

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

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

  4. taghaboy
    Member
    Posted 2 years ago #

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

  5. thearnavjoy
    Member
    Posted 1 year ago #

    before the query right following
    remove_all_filters('posts_orderby');

  6. taghaboy
    Member
    Posted 1 year ago #

    thanks for your reply
    i'd like to know what the "remove_all_filters" do?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags