方法1:
效果:
打开functions.php,加入:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//添加老文章提示信息 function old_content_message($content) { $modified = get_the_modified_time('U'); $current = current_time('timestamp'); $diffTime = ($current - $modified) / (60 * 60 * 24); global $wp; $current_url = home_url(add_query_arg(array(),$wp->request)); if ($diffTime > 365 and !strstr($current_url, "feel") ) { $content = $content.'<div class="warn">本文最后更新于'.get_the_modified_time('Y年n月j日'). ',已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!</div>'; } return $content; } add_filter('the_content', 'old_content_message'); |
CSS效果:
|
1 |
.old-message{padding:10px;color: #DB7C22;font-size: 14px;background: #FFFCEF;border: solid 1px #FFBB76;border-radius: 2px;box-shadow: 0 0 3px #ddd;} |
方法2(推荐):
functions.php:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//添加老文章提示信息 function old_content_message($content) { $modified = get_the_modified_time('U'); $current = current_time('timestamp'); $diffTime = ($current - $modified) / (60 * 60 * 24); global $wp; $current_url = home_url(add_query_arg(array(),$wp->request)); if ($diffTime > 365 and !strstr($current_url, "feel") ) { $content = $content.'<div class="warn">本文最后更新于'.get_the_modified_time('Y年n月j日'). ',已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!</div>'; } return $content; } add_filter('the_content', 'old_content_message'); |
如果想出现在文章开头,则改为:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//添加老文章提示信息 function old_content_message($content) { $modified = get_the_modified_time('U'); $current = current_time('timestamp'); $diffTime = ($current - $modified) / (60 * 60 * 24); global $wp; $current_url = home_url(add_query_arg(array(),$wp->request)); if ($diffTime > 365 and !strstr($current_url, "feel") ) { $content = '<div class="warn">本文最后更新于'.get_the_modified_time('Y年n月j日'). ',已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!</div>'.$content; } return $content; } add_filter('the_content', 'old_content_message'); |
CSS:
|
1 2 3 4 5 6 7 8 9 10 |
/* 提醒 */ .warn { color: #ad9948; background: #fff4b9 url(img/warn.png) -1px -1px no-repeat; border: 1px solid #eac946; overflow: hidden; margin: 10px 0; padding: 15px 15px 15px 35px; font-size: 14px; } |





最新评论
博主好,路过留言交流一下~我在做源头中转 Twinkle Model(利益相关):GPT 1折、国模 1折(GLM/DeepSeek/Kimi)、满血 Claude,低价稳定。价格全在模型广场 https://big-model.smart-agi.com/model-plaza ,有兴趣可以看看。
博主分享的 Surge 增强模式接管应用分流思路很赞!确实,系统大版本升级后,老牌 Proxifier 由于底层驱动兼容性问题经常莫名崩溃。在 Mac 上有 Surge 这种神器接管,但是在 Windows 平台上,很多人又很难找到兼顾‘轻量分流+稳定不崩溃’的工具:ProxiFyre 依赖 WireSock 内核驱动容易蓝屏且纯命令行,开 TUN 虚拟网卡又会把开发网段和公司 VPN 改乱。 如果是 Windows 用户寻找 Proxifier 替代品,非常推荐关注 Ghost Proxifier Pro: - 纯用户态 Winsock API Hook:完全免安装内核驱动和虚拟网卡,零蓝屏隐患,不改动系统默认网关与路由表; - 智能递归子进程树:很多现代客户端(如播放器、流媒体套件、IDE)会派生子进程,它能自动递归识别并接管流量,杜绝漏代理; - 现代 Fluent 图形界面:直接拖入目标 exe 即可一键绑定 SOCKS5/HTTP 节点,比老版配置规则直观很多。 注:该工具为非开源的独立客户端软件。 - 官网主页:https://ghostproxifier.com - 项目发布:https://github.com/liliBestCoder/ghost-proxifier-pro
曾经最爱之一,还有emlog,zblog
感谢分享经验,谢谢站长!!已收藏
牛牛牛
同样
站长您好,亚马逊云咨询推广资源,望建立联系,可邮件,谢谢。
换友情链接吗?