• I’m trying to get my WordPress theme to retrieve all posts, except ones in a certain category. I’m using the following code:
    query_posts('orderby=post_date&order=desc&cat=-7');

    While this does successfully remove all posts from category 7, the posts do not display in order. They seem to show in a random order.
    I initially thought maybe it was a glitch in 2.5; but I’ve updated to 2.6, and same thing!

    How can I fix this? I’m going crazy over it!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Maybe reading carefully the documentationhelps:
    Template_Tags/query_posts#Orderby_Parameters

    Thread Starter danharper

    (@danharper)

    No, that doesn’t work. BTW, when I put orderby=post_date, I meant to put orderby_date.

    I’ve also tried
    query_posts(array('category__not_in'=>array(7),'showposts'=>10,'orderby'=>'date','order'=>DESC));
    Which is code I got from the Codex, and isn’t working.

    Thread Starter danharper

    (@danharper)

    Hey, sorry for the double-post; but I really need help with this! If someone can help, it’d be greatly appreciated.

    The only thing I can think of, is that I’m running the site on a Windows test server; but unless Apache/SQL on Windows somehow interprets things differently, that’s just stupid!

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Ignore certain categories in Loop – Posts not in order!!’ is closed to new replies.