Skip to content

Instantly share code, notes, and snippets.

@awakekat
Last active February 9, 2016 00:52
Show Gist options
  • Save awakekat/b179257799239a741681 to your computer and use it in GitHub Desktop.
Save awakekat/b179257799239a741681 to your computer and use it in GitHub Desktop.
repeater date ACF
<?php
/*
Template Name: Sunday Adult
*/
get_header(); ?>
<div class="primary-content col-md-7 col-md-push-2">
<main id="main" class="main" role="main">
<!-- Page Loop -->
<?php while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<p>Posted on <?php the_date(); ?></p>
<?php the_content(); ?>
<?php $repeater = get_field('sunday_adult');
// vars
$order = array();
// populate order
foreach( $repeater as $i => $row ) {
$timestamp = strtotime($row['sunday_adult_day']);
$order[ $timestamp ][] = $row;
}
ksort($order);
?>
<ul>
<?php
foreach($order as $time => $eventDay) {
if($time <= time()) continue;
foreach($eventDay as $event) {
?>
<li>
<strong><?php echo $event['sunday_adult_day']; ?>: </strong>
<?php echo $event['sunday_adult_title']; ?>
<?php echo $event['sunday_adult_room']; ?>
</li>
<?php
}
}
?>
</ul>
<?php endwhile; // End of the loop. ?>
</main><!-- #main -->
</div>
<?php get_sidebar('left'); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment