Home › Forums › General Issues › loop with post based on date picker › Reply To: loop with post based on date picker
this code did the trick
<?php $today = date("Ymd");?>
<?php $loop = new WP_Query( array(
'post_type' => 'reports',
'posts_per_page' => 5,
'meta_key' => 'date',
'meta_compare' => '>=',
'meta_value' => $today,
'orderby' => 'meta_value_num',
'order' => 'ASC'
) ); ?>
<?php while ($loop->have_posts()) : $loop->the_post(); ?>
// do stuff
<?php endwhile; ?>
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.