定位:/wp-content/themes/zibll/func.php文件里面,没有这个文件自己创建一个,记得加上php头,要不然报错,将下面的代码放里面,CSS代码直接丢到:子比主题–>>自定义CSS样式即可!
func代码
- // 文章过期提示开始第一款
- 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=qq号&site=qq&menu=yes"><b>站长</b></a>。</div >';
- }
- echo $custom_content;
- }
- add_action('zib_posts_content_before', 'article_time_update');
复制代码 CSS代码
- .article-timeout{position:relative; border-radius: 8px; position: relative; margin-bottom: 25px; padding: 10px; background-color: var(--body-bg-color);}
复制代码