主题美化合集,子比主题zibll美化教程

1、文章底部添加最后更新时间或过期失效提示
  • 分为三个步骤
  • 1.将下面的 PHP 代码加入到主题目录下:themes/zibll/functions.php 文件中。
//文章过期提示开始
// BY:爱艺云库-blog.ay6.top
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="客服-YOYO" href="https://blog.ay6.top/"><b>爱艺云库客服</b></a>。</div >';
    }
        echo $custom_content;
    }

//文章过期提示结束

说明:请自己修改上面有关于自己网站的信息,改成自己网站信息即可,图标可以用阿里矢量图。

  • 2.在主题目录themes/zibll/inc/functions/zib-single.php 文件中,文章分页函数(我的是在 316 行,因为我的代码有改动,所有不确定行数,见下图)下面添加下方代码即可。
  • PHP 代码:
article_time_update();//文章过期提示
图片[1]-主题美化合集,子比主题zibll美化教程-爱艺博客

3.CSS 代码:(在自定义 CSS 样式添加下面代码)

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

效果展示:

图片[2]-主题美化合集,子比主题zibll美化教程-爱艺博客

温馨提示:本文最后更新于2024-01-14 21:25:43,某些文章具有时效性,若有错误或已失效,请在下方留言或联系爱艺云库客服
© 版权声明
THE END
喜欢就支持一下吧
点赞24 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容