温馨提示:本文最后更新于
2025-06-04 17:12:13
,某些文章具有时效性,若有错误或已失效,请在下方留言。文章过期提示
//文章过期提示开始
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= '<style>.article-timeout{position:relative; border-radius: 8px; position: relative; margin-bottom: 25px; padding: 10px; background-color: var(--body-bg-color);}</style><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="Stewed Noodles资源站" href="http://wpa.qq.com/msgrd?v=3&uin=2211045008&site=qq&menu=yes"><b>站长</b></a>。</div >';
}
echo $custom_content;
}
//下边的钩子留一个即可
add_action('zib_posts_content_after','article_time_update');//这是添加到文章底部
add_action('zib_posts_content_before','article_time_update');//这是添加到文章顶部
//文章过期提示结束
CSS代码:(在自定义CSS样式添加下面代码)
/*过期文章提示样式*/
.article-timeout{position:relative; border-radius: 8px; position: relative; margin-bottom: 25px; padding: 10px; background-color: var(--body-bg-color);}
© 版权声明
THE END
暂无评论内容