Support

Account

Home Forums Add-ons Repeater Field How to get future events with Date Picker? Reply To: How to get future events with Date Picker?

  • This is just a basic example, I could not copy and alter your code easily because you didn’t use code tags. You need to test the date before you output the table row, I can’t give specifics because that would depend on knowing how the date is being formatted. I am going to assume that dates are returned in the format “Y-m-d”, which would basically be the only way to tell if the date is in the future.

    
      if (have_rows('calender_event', 'option')) {
        while (have_rows('calender_event', 'option')) {
          $name = get_sub_field('event_name');
          $date = get_sub_field('event_date');
          $place = get_sub_field('event_place');
          $now = date('Y-m-d');
          if ($date > $today) {
            ?>
              <tr>
                <td>...</td>
                <td>...</td>
                <td>...</td>
              </tr>
            <?php 
          }
        } // end while have rows
      } // end if have rows