详情
评论
问答

子比主题 – 文章添加更新时间

文章最后更新时间:2025-06-08 22:27:58

 

图片[1]--阿七|阿七源码|建站源码|小程序源码|模板|下载子比主题 – 文章添加更新时间--阿七|阿七源码|建站源码|小程序源码|模板|下载阿七源码

部署之后,我先说一下很多人都说为什么在文章前面,难道不能放后面吗,可以放后面,下面两款的func文件代码里面的其中代码,如下,我们把before改成after就是文章之后显示了,学会了吧!

add_action('zib_posts_content_before', 'article_time_update');

定位:/wp-content/themes/zibll/func.php文件里面,没有这个文件自己创建一个,记得加上php头,要不然报错,将下面的代码放里面,CSS代码直接丢到:子比主题–>>自定义CSS样式即可!

func代码:

// 文章过期提示结束 www.xuwbk.com
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-update-tips"><p class="update-ts">文章最后更新时间:<span1>' . $updated_date . '</span1></p></div>';
    }
    echo $custom_content;
}
add_action('zib_posts_content_before', 'article_time_update');

CSS代码:

 

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容