Created
August 13, 2012 23:36
-
-
Save senlin/3344853 to your computer and use it in GitHub Desktop.
Display a message on older posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //display a message on older posts | |
function older_post_message () { | |
$posted = get_the_time('U'); | |
$current = current_time('timestamp'); | |
//Convert difference in seconds to days | |
$diffTime = ($current - $posted) / (60*60*24); | |
if($diffTime > 365){ | |
echo '<div class=older-post-message>' . __('This post was written more than a year ago and <em>might</em> not be entirely accurate anymore.', 'text-domain') . '</div><br />'; | |
} | |
} | |
add_action('get_template_part_content','older_post_message'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment