I'm using a conditional statement to compare the current date with a date of a custom post type. I'm using ACF for the date field of the custom post.
The statement works fine if the date of the event is in the current year. However if I change the date to a date in 2018 the statement fails.
I only have no clue why this fails. This is my code which is fine if both dates are in the same year.
$today = new DateTime(); $date_event = DateTime::createFromFormat('j F Y', get_field('date_event')); if($date_event > $today && is_singular('events') && get_field('aanmeldformulier_tonen')) :;?> // do stuff <?php else:?>