WordPress.org

Ready to get started?Download WordPress

Forums

query_post sorting headache! (1 post)

  1. threeds
    Member
    Posted 8 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic