Last active
August 29, 2015 13:55
-
-
Save markbain/8733163 to your computer and use it in GitHub Desktop.
group posts by date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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