古い投稿にのみ、メッセージを表示する

Ads

Code

<?php
$time_defined_as_old = 60*60*24*365; // 1年
if((date('U')-get_the_time('U')) > $time_defined_as_old) {
echo '<div class="notice"><strong>ご注意!</strong><br />この記事は1年以上前に投稿された記事で現在は正しい情報とは限りません。</div>';
}
?>
view raw gistfile1.aw hosted with ❤ by GitHub

Screen shot

Note

Description 古い投稿に限定して特定のメッセージを表示出来る。コードは1年前で設定。
WordPress Ver. 3.3.1
Via Notify of Old Post in WordPress