Home Forums Add-ons Repeater Field How to show only fields if the date is true


How to show only fields if the date is true

  • Hello,

    I’m looking since couple of hours and I dont found and to be honest, i don’t have enough skills to get everything.

    My problem is, i made a repeater with some text information and 2 date pickers. 1 for start and the 2 for end.

    I want to display only the repeater which is matching with TODAY. Refering with the start, end and between date only. Not the past or the future. From now, I dont have the past fields, but still the future.

    May someone help me ?


    Here is my code:

    // check if the repeater field has rows of data
    if( have_rows('mets') ):
    // loop through the rows of data
    while ( have_rows('mets') ) : the_row();
    // display a sub field value
    $datedeb = get_sub_field('begin', false, false);
    $datefin = get_sub_field('end', false, false);
    $today = strtotime(date('Ymd'));
    $promoend = strtotime($datefin);
    $datedeb = new DateTime($datedeb);
    $datefin = new DateTime($datefin);
    <?php if ($promoend >=$today): ?>
    <?php endif; ?>
    else :
    // no rows found
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.