WordPress.org

Support

Support » How-To and Troubleshooting » query_post sorting headache!

query_post sorting headache!

  • Forgive my ignorance, I’m trying to achieve something quite simple in WordPress. I have several posts and I want to sort these post first by ascending category, and descending date. Something like

    SELECT * FROM wp_posts order by post_category ASC, post_date DESC

    I’ve been trying to break down the query_posts function, but I can’t seem to get it to work like that. Without actually hacking the function (since I dont want to break any plugins that might utilise it), is there a way to order my posts the way I want it? Better still, instead of using query_post in the main page, can I substitute it with my own SQL Code?

    Many thanks for any help!

  • The topic ‘query_post sorting headache!’ is closed to new replies.