How to make a archive page template
-
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]
How to make a archive page template to show all post listed by months with no of comments. currently i m using this one code for showing the month and post in that month. i need to show the no of comments too.. Plz Help Me
<?php // Declare some helper vars $previous_year = $year = 0; $previous_month = $month = 0; $ul_open = false; // Get the posts $myposts = get_posts('numberposts=-1&orderby=post_date&order=DESC'); ?> <?php foreach($myposts as $post) : ?> <?php // Setup the post variables setup_postdata($post); $year = mysql2date('Y', $post->post_date); $month = mysql2date('n', $post->post_date); $day = mysql2date('j', $post->post_date); ?> <?php if($year != $previous_year || $month != $previous_month) : ?> <?php if($ul_open == true) : ?> <?php endif; ?> <h3 ><?php the_time('F Y'); ?></h3> <ul class="month_archive" > <?php $ul_open = true; ?> <?php endif; ?> <?php $previous_year = $year; $previous_month = $month; ?> <li><span class="the_day"><?php the_time('d') ?>:</span> <span class="the_article"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></span></li> <?php endforeach; ?>
Thanks in advance .
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘How to make a archive page template’ is closed to new replies.