Skip to content

Instantly share code, notes, and snippets.

@jdtdesigns
Created February 8, 2016 22:05
Show Gist options
  • Save jdtdesigns/36838893df527be45f74 to your computer and use it in GitHub Desktop.
Save jdtdesigns/36838893df527be45f74 to your computer and use it in GitHub Desktop.
<?php
$repeater = get_field('the_date');
foreach( $repeater as $i => $row ) :
$column_id[ $i ] = $row['the_date'];
endforeach;
array_multisort( $column_id, SORT_ASC, $repeater );
$month = '';
foreach( $repeater as $row ) :
$date = DateTime::createFromFormat('Ymd', $row['the_date']);
if ($month != $date->format('F')) : ?>
<ul>
<li><?php echo $date->format('F'); ?></li>
<li><?php echo $row['name']; ?></li>
</ul>
<?php else : ?>
<ul>
<li><?php echo $date->format('m/d'); ?></li>
<li><?php echo $row['name']; ?></li>
</ul>
<?php endif; ?>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment