I'm using a custom fields plugin for WordPress (Advanced Custom Fields) and am using a time picker field set to format: "h:mm tt". Using a typical WP query, I'm attempting to sort by "start time" in ascending order, but the returned lists of posts seems to sort on ascending numerical value (i.e. 12:00 PM would appear after 6:00 PM). I checked the custom field data and it's definitely being saved as a UNIX timestamp (start time of '1383224400' for example).
I've passed a few combinations of arguments to query_posts but nothing I've tried has worked. Here is the query I'm using:
<?php $args = array( 'post_type' => 'friday_event', 'orderby' => 'meta_value_num', 'meta_key' => 'start_time', 'order' => 'ASC', 'nopaging' => true ); query_posts( $args ); while ( have_posts() ) : the_post(); ?>
Any ideas what I might be doing wrong? I've tried using a custom 'meta_query' where I set 'meta_value' to a variable and do a custom compare, but I still can't get the posts to sort correctly. Any help is very much appreciated!