百度未收录

WordPress文章失效提示美化版

效果演示

WordPress文章失效提示美化版-狐狸库

将下面的函数代码加入到主题目录下 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= ' <h1 class="wp-block-zibllblock-biaoti title-theme" id="wznav_999">温馨提示:</h1> <div class="article-timeout" style="font-size:20px;"><B> ?温馨提示:</B>本文最后更新于<code style="background-color: rgba(253,153,153,.2);">'. $updated_date . '</code>,某些文章具有时效性,若有错误或已失效,请在下方<a href="#comment" style="color:#ff3c98;">留言</a>或联系<a target="_blank" title="狐狸" href="http://wpa.qq.com/msgrd?v=3&uin=89385889&site=qq&menu=yes" style="color:#ff3c98;"><b>狐狸</b></a>。</div >'; } echo $custom_content;}

在主题目录zibll/inc/functions/zib-single.php文件中,文章分页函数(大概是322行,因为我的代码有改动,所有不确定行数,见下图)下面添加下方代码即可。

article_time_update();//文章过期提示
WordPress文章失效提示美化版-狐狸库

在自定义CSS样式添加下面代码

第二种样式

WordPress文章失效提示美化版-狐狸库

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="背时狐狸" href="http://wpa.qq.com/msgrd?v=3&uin=97538110&site=qq&menu=yes"><b>背时狐狸</b></a>。</div >';
    }
        echo $custom_content;
    }

2.在主题目录themes/zibll/inc/functions/zib-single.php 文件中,文章分页函数(没有修改的话就是308 行)添加下方代码即可。主题目录themes/zibll/template/single-dosc.php 文件里改是没有用的!

WordPress文章失效提示美化版-狐狸库
article_time_update();//文章过期提示

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

温馨提示:本文最后更新于2022/10/26 20:05:55。若文章内容或图片失效,请留言联系站长反馈!
!
也想出现在这里? 联系我们
创意广告
© 版权声明
THE END
点赞0赞赏 分享
评论 共32条

请登录后发表评论

    请登录后查看评论内容