Home Forums Add-ons Repeater Field repeater dates arranged by months title Reply To: repeater dates arranged by months title

  • Thank you James
    I have done the repeater sort. it sorts by date. and also hide the past dates…
    but i need to separate the dates into months and hide past months –
    this is the problem i couldn’t figure.

    the code i used so far.

    // get repeater field data
    $repeater = get_field('vacation_repeater1');
    // vars
    $order = array();
    if( $repeater ):
    // populate order
    foreach( $repeater as $i => $row ) {
    	$order[ $i ] = $row['start_date'];
    array_multisort( $order, SORT_ASC, $repeater );
    	<?php foreach( $repeater as $i => $row ): ?>
    	$end_date = get_sub_field('end_date');
    			$today = date('Ymd');
    	$get_startdate = $row['start_date'];
    	$start_date = (strtotime($get_startdate));
    //use $get_startdate to order, and $start_date_pretty to output your date
    	$start_date_pretty = date_i18n( 'l, F j, Y', $start_date );
    <?php if($today <= $get_startdate ) { ?>
    <li class="flight_date_time">
    	<?php echo $start_date_pretty; ?>
    <li class="flight_date_time">
    	<?php echo $row['end_date']; ?>
    <div class="clear"></div>
    <?php } ?>
    	<?php endforeach; ?>
    <?php endif; ?>