I am trying to sort posts Ascending based on a Date and Time Picker custom field called: date_and_time_picker. The code I have is the following:
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
query_posts($query_string.’&category_name=events&meta_key=date_and_time_picker&meta_compare=>=&meta_value=’.strtotime(date(“Y-m-d”)).’&orderby_meta_key=date_and_time_picker&order=ASC&posts_per_page=12&paged=’ . $paged);
For some reason it is sorting using the post date instead. Can someone help me figure out what could be wrong with this code?
This is the page: http://www.beckywasserman.com/current-events/
Thanks,
Andrea
From what I understand there is a bug in the date and time picker, more than likely caused by changes in the version of jquery used by WP. There was a similar issue here https://support.advancedcustomfields.com/forums/topic/meta_query-orderby-overwritten-by-publish-date/. If you post in that topic maybe that person can tell you what he’s doing to fix his problem or you should try contacting the author of the date and time picker https://wordpress.org/support/plugin/acf-field-date-time-picker
For anyone seeing a problem with the add on, a Time Picker and Date/Time picker have been added to ACF Version 5.3.9