Support

Account

Home Forums Front-end Issues Display past and upcoming events?

Unread

Display past and upcoming events?

  • Hi I would like to know how can I display past and upcoming events separately. I was thinking about looping into the events and comparing the date’s day, months and years individually between each other. Could that be the right path? This is the code that right now displays the start and end dates of the events.

    Thank you!

    <?php $date = get_field('event_date_start');
    $y = substr($date, 0, 4);
    $m = substr($date, 4, 2);
    $d = substr($date, 6, 2);
    echo ', ' . $d . "|" . $m . "|" . $y; ?>
    <?php if(get_field('event_date_end')) { $date = get_field('event_date_end');
    $y = substr($date, 0, 4);
    $m = substr($date, 4, 2);
    $d = substr($date, 6, 2);
    echo '&bull;&nbsp;' . $d . "|" . $m . "|" . $y; } ?></span>
Viewing 1 post (of 1 total)

The topic ‘Display past and upcoming events?’ is closed to new replies.