I use the bellow template to display the first event from an ascendent list of custom post type events, created by a third party plugin. What I want is to exclude old events, displaying only the one actual, if we have one today, or the nearest. The event start date is saved in a
meta_key with a value in the “Y-m-d” format (ex: 2017-10-27). How to accomplish this?
'events', 'posts_per_page' => 1, 'meta_key' => 'event_start_date', 'order' => 'ASC' ); $featured = new WP_Query($args); if ($featured->have_posts()): while($featured->have_posts()): $featured->the_post(); $featured_event_start = $post->event_start_date; $featured_event_end = $post->event_end_date; if (has_post_thumbnail()) : ?>