Support

Account

Home Forums Add-ons Repeater Field Show future dates using date & time, repeater fields Reply To: Show future dates using date & time, repeater fields

  • Solved! Thanks to James and a help ticket and this blog post: http://joshuaiz.com/words/ordering-events-by-advanced-custom-fields-date-time-picker-field/

    First I changed the date&time field output to a unix timestamp, to do so just put a capital U under custom.

    then add:

    $eventTIME = get_sub_field('event_date_time');
    $today = current_time('timestamp'); // Get current unix timestamp
    if($eventTIME<$today) continue; 

    If the event date is smaller than today’s date it skips it.

    However, all my pretty dates were now displaying as unix timestamps. I changed the code to display them to this:

    <?php $start = get_sub_field('event_date_time'); echo date_i18n('F j, Y - g:i a', $start); ?>

    And done!