0

我有一个博客页面收集“新闻”类别中的所有帖子,但所有帖子都显示相同的日期(2013 年 5 月 5 日),但星期几的名称不同

这是代码:

$wp_query = new WP_Query();
$wp_query->query('post_type=post&category_name=news&paged='.$paged);
?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">
        <div class="title">
            <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
            <div class="postmeta">  <span>Posted on  <?php the_time('l, n F Y'); ?></span></div>

这是 the_time 输出:

Posted on Saturday, 5 May 2013

Posted on Tuesday, 5 May 2013

Posted on Tuesday, 5 May 2013

Posted on Monday, 5 May 2013

5 月 5 日没有发布任何帖子或页面……我不知道要解决这个问题……请帮忙!

编辑:

发现问题,改一下:

<?php the_time('l, n F Y'); ?>

有了这个:

<?php the_time('l, j F Y'); ?>
4

2 回答 2

1

您的问题与<?php the_time('l, n F Y'); ?>. 您指定的n是指月份的数字,May5。你需要的是j.

<?php the_time('l, j F Y'); ?>
于 2013-05-20T12:58:21.913 回答
0
Go wp-admin in "post" option edit your post is "Published on" option edit set your date and time.
same step in page option.
于 2013-05-20T12:25:22.277 回答