温馨提示文章时效性
本文共866 个字, 需约3 分钟阅读。本文最后更新时间为2024年11 月3日, 部分内容具有时效性,如有失效请留言告知,阅读量:820 阅读

//文章过期提示
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></div >';
} echo $custom_content;
}
上面的代码可以自行修改自己喜欢的字
/*过期文章提示样式*/
.article-timeout{position:relative; border-radius: 8px; position: relative; margin-bottom: 25px; padding: 10px; background-color: var(--body-bg-color);}s加载

article_time_update();//文章过期提示
版权声明:
作者:Caton
链接:https://faq.gebin.show/122.html
文章版权归作者所有,未经允许请勿转载。
全篇结束