I'm trying to fetch all the posts from today to next week by using some custom fields inside posts, using Advanced Custom Fields.
Everything was working until now, because it doesn't show posts from the next month. For example:
I've got posts whose 'date' custom field is
'30/01/2015' and everything is working.
But I've got some posts which 'date' is
'02/02/2015' and they're not showing at all.
In ACF I've set the 'date' custom field as a jQuery Datepicker, which show dates in
dd/mm/yy format and save them also as
This is my code:
$t=date('d/m/Y',strtotime('+7 day')); $o=date('d/m/Y',strtotime('today')); $d=new WP_Query( array( 'category__in' => array(4), 'post_type' => 'post', 'posts_per_page' => '-1', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( 'relation' => 'AND' array( 'key' => 'data', 'value' => $o, 'compare' => '>=' ), array( 'key' => 'data', 'value' => $t, 'compare' => '<' ) ) ) );
Can someone help? Thanks in advice.