Reputation:
I want to build my own archives page that displays in the format that I want. I want to show all post title, order by month and year. It should look like this :
December 2011 Post title 1 3 comments Post title 2 4 comments
November 2011 Post title 1 2 comments
I'm having trouble figuring out the specifics of the loop that needs to be created for getting the post title and it's comments order by month.
This is the archives page example I want to build http://spyrestudios.com/archives/.
Please help. Thanks in advance.
Upvotes: 4
Views: 529
Reputation: 2986
You can use WP_Query to do that
Try this code(i don't tested it):
<?php
$date = '';
$query = 'posts_per_page=9999';
$queryObject = new WP_Query($query);
// The Loop...
if ($queryObject->have_posts()) {
while ($queryObject->have_posts()) {
$queryObject->the_post();
$my_date = the_date('F j', '', '', FALSE);
if ($my_date!=$date){
echo '<h2>'.$my_date.'</h2>';
$date = $my_date;
}
echo '<h3>';
the_title();
echo '</h3>';
echo '<span>';
comments_popup_link('No Comments »', '1 Comment »', '% Comments »');
echo '</span>';
}
}
?>
Upvotes: 0
Reputation: 4860
this may help you.
http://codex.wordpress.org/Creating_an_Archive_Index
Upvotes: 2