我使用下面的代码生成“当月+当月帖子”列表。
我需要做些什么来显示每月的帖子数量?
<?php
$previous_year = $year = 0;
$previous_month = $month = 0;
$dl_open = false;
// Get the posts
$myposts = get_posts(\'numberposts=-1&orderby=post_date&order=DESC&post_type=byte\');
?>
<?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(\'d\', $post->post_date);
?>
<?php if($year != $previous_year || $month != $previous_month) : ?>
<?php if($dl_open == true) : ?>
</dl>
<?php endif; ?>
<h3><?php the_time(\'F Y\'); ?></h3>
<dl id="post-list">
<?php $dl_open = true; ?>
<?php endif; ?>
<?php $previous_year = $year; $previous_month = $month; ?>
<dt><?php the_time(\'d\'); ?> <a href="<?php the_permalink(); ?>" title="read it"><?php the_title(); ?></a></dt>
<dd><?php the_excerpt(); ?></dd>
<?php endforeach; ?>
</dl>