温馨提示文章时效性

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


//文章过期提示
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;
}

上面的代码可以自行修改自己喜欢的字

需要在子比主题后台的自定义css那里添加下面的cs

/*过期文章提示样式*/
.article-timeout{position:relative; border-radius: 8px; position: relative; margin-bottom: 25px; padding: 10px; background-color: var(--body-bg-color);}s加载

在主题目录zibll/inc/functions/zib-single.php文件中

文章分页函数行,里面的(具体在296行,这是在没有任何代码添加且是子比主题6.1版本的情况下)如果小伙伴有代码修改的话,需要自己寻找地方,具体位置如图:

article_time_update();//文章过期提示

全篇结束