Skip to content

Instantly share code, notes, and snippets.

@markbain
Last active August 29, 2015 13:55
Show Gist options
  • Save markbain/8733163 to your computer and use it in GitHub Desktop.
Save markbain/8733163 to your computer and use it in GitHub Desktop.
group posts by date
<?php
$day_check = '';
while (have_posts()) : the_post();
$day = get_the_date('j');
if ($day != $day_check) {
if ($day_check != '') {
echo '</ul>'; // close the list here
}
echo get_the_date() . '<ul>';
}
?>
<li><a href="#"><?php the_time(); ?><?php the_title(); ?></a></li>
<?php
$day_check = $day;
endwhile; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment