Hi. I am trying to make an archive page that displays all of the posts, grouped by date, like this:
1/16/2013
Post 1
Post 2
1/15/2013
Post 3
Post 4
I ALMOST have it working using this code:
$args = array('posts_per_page' => -1, 'orderby' => 'date' );
$myQuery = new WP_Query($args);
$date = '';
if ( $myQuery->have_posts() ) : while ( $myQuery->have_posts() ) : $myQuery->the_post();
if ( $date != get_the_date() ) {
echo $date;
echo '<hr />';
$date = get_the_date();
}
the_title();
echo '<br />';
endwhile; endif;
wp_reset_postdata();
But the date is displayed below the post titles, as you can see here:
http://cropcircleshawaii.com/test/all-posts/
And I would like it displayed above the post titles. How do I do this?
Thanks for your help!