Show/Hide Repeater field based on start/end date
<?php if( have_rows('contact_hours', 25) ): ?> <div class="footer-hours"> <div class="footer-hours-title">Hours</div> <?php while ( have_rows('contact_hours', 25) ) : the_row(); ?> <?php $begin_date = DateTime::createFromFormat('m', get_sub_field('date_range_beginning')); $end_date = DateTime::createFromFormat('m', get_sub_field('date_range_ending')); $current_date = (int) date('m'); $start = (int) get_sub_field('date_range_beginning'); $end = (int) get_sub_field('date_range_ending'); if ($current_date >= $start && $current_date <= $end) { ?> <div class="footer-hour-segment"> <div class="contact-range"> <div class="contact-date-range"><?php echo $begin_date->format('F'); ?> - <?php echo $end_date->format('F'); ?></div> <div class="contact-hour-days"><?php the_sub_field('contact_hour_days', 25); ?></div> <div class="contact-hour-hours"><?php the_sub_field('contact_hour_hours', 25); ?></div> </div> </div> <?php } ?> <?php endwhile; ?> </div><!--footer-hours--> <?php endif; ?>