【网站美化】文章底部添加最后更新时间或过期失效提示

图片[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="xx站" href="http://wpa.qq.com/msgrd?v=3&uin=1628050&site=qq&menu=yes"><b>站长</b></a>。</div >';
    }
        echo $custom_content;
    }
//文章过期提示结束

在主题目录themes/zibll/inc/functions/zib-single.php 文件中,文章分页函数下面添加下方代码即可(大概在320行左右)。

article_time_update();//文章过期提示
图片[2]-【网站美化】文章底部添加最后更新时间或过期失效提示-凤翼天翔剧社

【Zibll主题设置】 – 【全局&功能】– 【自定义代码】]– 【自定义CSS样式】,添加下面的CSS代码即可

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

ps:这个不知道为什么,之前成功了,但不是显示在文章页最下方,显示在最上方。隔了一天再看没了,不知道咋回事儿!失败😓

温馨提示: 本文最后更新于2025-02-06 19:01:49,某些文章具有时效性,若有错误或已失效,请在下方 留言
本站内容仅供学习和研究使用,请在下载后24小时内删除 凤翼天翔
THE END
喜欢就支持一下吧
点赞9 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

夸夸
夸夸
还有吗!没看够!
取消
昵称表情图片

    暂无评论内容