繁体   English   中英

日期(); 在额外的帖子后没有显示

[英]the_date(); is not displaying after additional posts

目前在Wordpress中有一点问题,在加载最近的帖子后显示日期。

在最近的帖子中,帖子显示日期。 以前的帖子不显示日期。

我正在使用the_time()来获取帖子的创建时间,这对我所有的连续帖子都很好。

这是我的HTML:

<div class="sectionContainer col-xs-10">

<div class="sectionHeader">
    <p>Recent posts <img src="<?php bloginfo('template_directory'); ?>/gator-alt.svg" class="img-responsive pull-right"></p>
</div>

<div class="postContainer">

    <?php query_posts('showposts=5');

        if( have_posts() ): while( have_posts() ): the_post(); ?>

        <p class="postTitle">
            <?php the_title(); ?>
        </p>

        <p class="postDateTime">
            <?php the_date();?> @
                <?php the_time();?>
        </p>

        <div class="postContentContainer">
            <p class="postContents">
                <?php the_content(); ?>
            </p>
        </div>

        <?php endwhile;
              endif;

        ?>
</div>

这是一张完整描绘正在发生的事情的图像。 你可以看到最近的帖子显示日期,以前的帖子没有。

日期();显示问题

请注意the_date()函数中的以下内容。

如果当前帖子的日期与前一个输出不同,则仅输出日期。

尝试使用函数get_the_date()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM