WordPress文章显示最后一次修改时间

代码2020-09-06811 人已阅来源:网络

互联网信息更新快,一段时间以前的某些内容可能已经失效,如果显示的是最后一次修改时间,那么用户会觉得文章发布(修改)的比较晚,可读性或者可靠性比较高

<div class="disc">
    <span>本文发布于<?php the_time('Y-n-j H:s'); ?></span>
    <?php if ((get_the_modified_time('Y')*365+get_the_modified_time('z')) > (get_the_time('Y')*365+get_the_time('z'))) : ?><span>最后修改于<?php the_modified_time('Y-n-j H:s'); ?></span><?php endif; ?>
    <span>分类<?php the_category(’, ‘) ?></span>
    <?php edit_post_link(); ?>
</div>