更新时间:2023-12-01 23:12:04
您可以使用WP_Query来做到这一点
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>';
}
}
?>