Archive page grouped by date
-
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 21/15/2013
Post 3
Post 4I 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:
https://cropcircleshawaii.com/test/all-posts/
And I would like it displayed above the post titles. How do I do this?Thanks for your help!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Archive page grouped by date’ is closed to new replies.