Advanced ordering of query_posts

I don’t think this is doable in a single WP API query. You just don’t sort whole set with single logic, you have logic changing halfway. I don’t think even SQL can express this.

It is hard to advise without seeing specific circumstances (such as counts, pagination involved and so on), but my first thought would be to split this into two queries:

  1. “Future” posts (meta query for date field in future, order by title)
  2. “Past” posts (meta query for date field in the past, order by title)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)