I have a meta value for a custom post type called
workshop which is the
start_time of the workshop as a UNIX timestamp. Right now I'm able to sort the posts ascending or descending with
$query->set('posts_per_page', -1); $query->set('meta_key', 'start_time'); $query->set('orderby', 'meta_value_num'); $query->set('order', 'ASC');
What I would like to do is sort it 2 different ways since some workshops may be the in future and some may have passed already. So my ideal sorting would be:
- First the workshops that are still in the future, ie
start_time >= time()sorted
- Then the workshops that are not in the future, ie
start_time < time()sorted DESC.
But they would still show up in the same query. Is there a way to do this?