Reputation: 29
I want to display the two dates that are closest to the current date, but only if they're in the future. I'm using the ACF date-picker for this.
I'm not very good at php, so I'd appreciate if someone could point me in the right direction!
Upvotes: 0
Views: 693
Reputation: 126
you could try something like:
$args = array(
'post_type' => 'your_post_type',
'posts_per_page' => 2,
'meta_query' => array(
'key' => 'your_field_key',
'compare' => '>',
'value' => date('Y-m-d H:i:s'),
'type' => 'DATETIME'
)
);
Hope that helps?
Upvotes: 1