john2016
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: order by meta_value where value contains array with dateTrishaM, thank you for your answer.
The dates are stored in this format: m.d.Y
But they are stored in the custom field movie_time_values together with some other values. Example value:
',{"theatre":"","date":"05.28.2016","time":"20:00","place":"","ticket":"","button_text":"","button_link":""}'So I need to sort the value of “date” ascending, in above example with value: 05.28.2016.
I am also struggling with some values in this code:
'meta_key' => 'movie_time_values', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'movie_time_values', 'value' => $today, 'compare' => '>=' ))I don’t know if relation is needed.
And i think value needs to be an array, because i need to point to the value of the date portion..Last night i was trying to get the post_id and date (strtotime) together in one array. Then reorder the array using ksort.
I was able to create the following array, but i wans’t able to sort on date. And after that i don’t know how to loop through the posts with the new ordered post_id list:
Array ( [0] => Array ( [1475193600] => 2067 ) [1] => Array ( [1475280000] => 2070 ) [2] => Array ( [1475280000] => 2078 )