效果显示:
![图片[1]-Zibll文章底部添加最后更新时间或过期失效提示美化-99源码屋](https://tu.99yiz.com/2021/12/20211226082316660.jpg?imageView2/0/format/webp/q/75)
教程开始:
- 1.将下面的 PHP 代码加入到主题目录下:themes/zibll/functions.php 文件中。
//文章过期提示开始
function article_time_update() {
date_default_timezone_set('PRC');
$newdate=time();
$updated_date = get_the_modified_time('Y-m-d H:i:s');
$updatetime=strtotime($updated_date);
$custom_content = '';
if ( $newdate > $updatetime+86400) {
$custom_content= '<div class="article-timeout"><strong><i class="fa fa-bell" aria-hidden="true"></i> 温馨提示:</strong>本文最后更新于<code>'. $updated_date . '</code>,某些文章具有时效性,若有错误或已失效,请在下方<a href="#comment">留言</a>或联系<a target="_blank" title="99源码屋" href="http://wpa.qq.com/msgrd?v=3&uin=2180266&site=qq&menu=yes"><b>99源码站长</b></a>。</div >';
}
echo $custom_content;
}
//文章过期提示结束
- 说明:请自己修改上面有关于自己网站的信息,改成自己网站信息即可,图标可以用阿里矢量图。
- 2.在主题目录themes/zibll/inc/functions/zib-single.php 文件中,文章分页函数下面添加下方代码即可。
感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
THE END
暂无评论内容