On my site I have a Whats On section which shows posts in a certain date range. The query that I use is as follows:
$the_query = new WP_Query(array( 'ignore_sticky_posts'=>1, 'category__in' => $category_list, 'posts_per_page' => 15, 'paged' => $paged, 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => 'EndDateUnix', 'meta_compare' =>'>=', 'meta_value'=>time() ));
This shows events that haven't finished yet, and orders them by the finish date. Ideally I want to order them by the start date, but as far as I can see the only way to do that is make the meta_key the start date, which is no good. Anyone know if I can do a meta_compare on one key, but order the results by a different key?
This topic is now closed. New replies are no longer allowed.