Thanks for the post.
The easiest way to go about this would be to create a custom query using the get_posts() function and filter the posts using the values entered in the datepicker field.
Essentially, the code would look like so:
<?php $today = date('Ymd'); $args = array ( 'post_type' => 'post', 'meta_query' => array( array( 'key' => 'start_date', 'compare' => '>=', 'value' => $today, ), array( 'key' => 'end_date', 'compare' => '<=', 'value' => $today, ) ), ); // get posts $posts = get_posts($args); ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.