Support

Account

Home Forums Front-end Issues Date picker in repeater field – display only 1 date – first in the future

Unread

Date picker in repeater field – display only 1 date – first in the future

  • Hello, I have list (repeater field) with dates in administration, for example:
    Dates:
    – 1. 5. 2017
    – 10. 7. 2017
    – 12. 8. 2017
    – 15. 9. 2017

    So the firts date is allready in past, so I need to display only those 3 dates.

    Just now I am using simple repeater fields option:

    <ul>
        <?php if(get_field('my-dates')): ?>
            <?php while(has_sub_field('my-dates')): ?>
                <?php
                    $datestart = get_sub_field('my-dates--start', false, false);
                    $datestart = new DateTime($datestart);
                    $dateend = get_sub_field('my-dates--end', false, false);
                    $dateend = new DateTime($dateend);
                ?>
                <li><?php echo $datestart->format('d. m. Y'); ?> - <?php echo $dateend->format('d. m. Y'); ?></li>
            <?php endwhile; ?>
        <?php endif; ?>
    </ul>
    

    Thanks for help,
    Kubajjz

Viewing 1 post (of 1 total)

The topic ‘Date picker in repeater field – display only 1 date – first in the future’ is closed to new replies.