I am developing a consultancy website which has event to it. I am using ACF for generating event
Firstly the event consists of 3 things,
- Past Events
- Ongoing Events + current events + upcoming events
I have successfully generated a Past event and upcoming event for the events post, but my question is I am adding a ribbon for the posts to show is the post is upcoming or ongoing or past or current.
In code I successfully generate a upcoming event and past event, but, I am unable to show the current event and ongoing event in the ribbon
the ribbon is like this
I added the following code to generate these ribbon
<div class="ribbon">
<?php
$event_date = get_field('event_date');
$events_date = new DateTime($event_date);
$event_timestamp = $events_date->getTimestamp();
//echo
if( $event_timestamp <= time()){
$ribbon = "Past Event";
}else{
$ribbon = "Upcoming Event";
}
?>
<span><?php echo $ribbon; ?></span>
</div>
for the ongoing event and the current event, there might be some thing which I should add in the above code but I cannot figure it out. Can U guys Please Help me to solve this issue
Note Also for the today date, my ribbon is showing past event and I don't why it is showing this.**
I too research the following stack overflow of these type but none of them work :( https://stackoverflow.com/questions/25622370/php-how-to-check-if-a-date-is-today-yesterday-or-tomorrow