添加一个变量以保存上一篇文章的日期,然后添加<br />
或者当它改变的时候。
<?php
$prev_date = \'\'; // initialize to empty string
query_posts($query_string.\'&cat=-3\');
while (have_posts()) : the_post(); ?>
<?php if( strlen( $prev_date ) > 0 && get_the_time( \'M j\' ) != $prev_date ): ?>
<br /> <!-- or whatever you want to use to separate your date blocks -->
<?php endif; ?>
<span class="date"><?php the_time(\'M j\') ?></span> -
<a class="title" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php $prev_date = get_the_time( \'M j\' );
?>
<!-- continue on with The Loop -->
<?php endwhile; ?>