Is it possible to order my list of custom posts, after filtering it with meta_query, by the meta data of my choice?
For example, I have a custom post type called webinars. I am trying to list all upcoming webinars, and have them ordered by the custom meta field called webinar_startDate.
Using the following query, I was able to return the webinars succesfully excluding the old webinars. However, they still come out in the order they were published, and not by webinar_startDate.
<?php $my_array = array(
'meta_query' => array(
array(
'key' => 'webinar_startDate',
'value' => date("Y-m-d H:i:s"),
'compare' => '>=',
'type' => 'DATETIME'
)
),
'orderby' => 'meta_value',
'post_type' => 'webinars',
'posts_per_page' => 20,
'order' => 'ASC'
); ?>
I suspect that due to the change from 3.0 to 3.1, the use of orderby => meta_value is probably different, but I can't find an answer within the WordPress documentation to explain this.
Can anyone help? Thanks in advance.