I’m trying to make event ticker with Advanced Custom Fields and I want to show only events that are happening on the current day or in the future. But I don’t know how to hide past events. Could anyone help me, please?
This is my code. It works fine, but it doesn't hide past events.
<?php $event = new WP_Query(array( 'post_type' => 'gacr-event', 'posts_per_page' => 5, 'orderby' => 'meta_value_num', 'order' => 'DESC' )); ?> <?php $date = DateTime::createFromFormat('Ymd', get_field('date')); ?> <?php while($event->have_posts()) : $event->the_post(); ?> <li> Posted on: <?php the_field('date'); ?><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> </li> <?php endwhile; ?>