PHP 在WordPress中通知Old Post

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 在WordPress中通知Old Post相关的知识,希望对你有一定的参考价值。

<?php
// Put inside Post Loop

$time_defined_as_old = 60*60*24*365; // A Year

if((date('U')-get_the_time('U')) > $time_defined_as_old) {
  echo '<div class="notice"><strong>Notice</strong><br />This article is published more than one year ago. Information in this article might be irrelevant with current situation</div>';
}

?>

以上是关于PHP 在WordPress中通知Old Post的主要内容,如果未能解决你的问题,请参考以下文章

PHP - Wordpress - 插件小部件更新功能 - 更新数组值 [Foreach 循环不起作用]

如何在 WordPress 中通过模板为 HTML 标签动态添加类

php WordPress ALT immagine在evidenza post thumbnail

php 在Wordpress上自定义the_post_navigation

PHP WordPress Post Thumbs Fallback

php 创建 zip 文件(来自 post 附件 wordpress)