Support » Fixing WordPress » Proplems with Displaying posts in certain orders (i’m stuck!)

  • I posted a request for a solution for this problem in the mod section and was unable to get a solution. I thought this may be a more appropriate area to post my question.

    I have been working pretty hard to display my posts in random order when a category of posts is selected from the menu. I’ve found plugins to modify the lists in the menu. and I’ve found resources to list the displayed posts by name,date,time,descending,ascending… and all other sorts of order. I can’t find the correct way to make my posts display in a random order.

    All of the previous orders where accomplished by using:
    <?php query_posts($query_string . “&order=ASC”); ?>
    I put this in the archive.php file right before the loop. Worked like a charm. When I try to make it RANDOM rather than ASCENDING I fail…. Miserably.

    I’ve tried RAND, RAND(), RANDOM, random, rand()….ect.

    I’m sure I’m missing something, and I’m sure there is a very bright person here who can possibly help. It’d be much appreciated. I’m absolutely stuck.

    Thanks soooo much in advance.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Just a guess. Does the doc for query_posts describe the allowable arguments?

    The query_posts doc is what’s gotten me this far. It say there are a bunch of options not listed. I’m assuming that some sort of RAND() feature is an option.

    I just can’t figure out how to make it apply.

    I think you answered your question with “assume”. Without looking in the code to find the undocumented settings, I wouldn’t hazard a guess what they are, or if they work, or would work in the future.

    You have posts from ID:#1 to ID:#”unknown but ever growing” in the data base. Which may be deleted or are pages and and not posts. Bonus points to learn they aren’t date sequential in the DB. Even if you get a RAND out of php or mysql (and you can), that doesn’t mean it points to anything you can display and the recursive crawl to find a displayable just makes my skin crawl.

    A small matter of coding that makes my skin crawl.

    I came up with this on another site.

    Will this work??

    I’m not sure how to implement it, but it looks like it my be a step in the right direction.

    Thanks for the assistance

    Seems like it might. All you have to do next is get that into a php script of your own.

    You really don’t want to do that. Why are archives random? Except for your enjoyment, do you really want that? I wouldn’t visit.

    Any thoughts on how to implement this mysql info to make the posts appear in random order?


    it’s not that I want the archive to be random. I’m using the archive section to ranomly display peoples artwork. I’d like everyone to have a equal shot at 1st, 2nd, 3rd ect. Using the archive allows me to organize the different artwork in the Posts.

    It makes the organization on the backend easier.

    Obviously making them appear in a random order is pretty hard. I don’t think I’ve ever asked a questions that has been so difficult to locate an answer.

    Ah, – Random images are much easier that random posts. I misunderstood the question.

    I did something similar once with random banner pictures using someone else’s script. Sadly, the author has moved on to other projects so I can find his website and it’s too long to post here. Contact me via my profile and website and I can email it to you. It’s only a starting point for what you want though.

    You might find that a plugin already exists (reinvented many times). If there is commentary about the image, that makes it a bit harder, You might want to look at the photo galleries subsystems and WP integration tools.

    Thanks for the help. The image shuffle would work fine also. As long as they can be used as links.

    I’ll contact you via email for more info.

    Thanks again




    speaking of shuffling..

    all you have to do is this:

    shuffle(query_posts("all your other crap in here"));

    leave out the rand thing, thats useless. I could have saved you alot of time If i’d read this earlier.

    It worked….. So simple. I’m amazed at how easy that was. I think next time I have to do this it may be a little easier;)

    Thank you so much for the help.




    youre welcome 🙂

    Thanks Whooami … i have been looking for this solution for a DAY now … THANKS A LOT!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Proplems with Displaying posts in certain orders (i’m stuck!)’ is closed to new replies.