Support

Account

Home Forums Add-ons Repeater Field How to show repeater fields by compare the current date with the date picker?

Helping

How to show repeater fields by compare the current date with the date picker?

  • Hi guys,

    Is it possible to show repeater fields by comparing the current date with the date entered in the date picker field? I need to list the birthday boy of the day. See my fields:

    Repeater Field: niver
    Sub-Field: name (text)
    Sub-Field: department (text)
    Sub-field: date (date-picker)

  • See my code:

    $today = new DateTime( 'today', new DateTimeZone('America/Sao_Paulo') );
    $date = new DateTime( get_sub_field('data') );
    
    if( have_rows('niver') ) : while ( have_rows('niver') ) : the_row();
       $name = get_sub_field('nome');
       $dpto = get_sub_field('departamento');
              
       if($today = $date){
    
       <div class="align-center">
          <h4 class="text-bold"><?php echo $name ?></h4>
          <p><?php echo $dpto ?></p>
       </div>
     }
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How to show repeater fields by compare the current date with the date picker?’ is closed to new replies.