Display Message on Older Posts

Supplemental 13 views
0 Flares 0 Flares ×

Use this snippet to display a message on older posts.

<?php //display a message on older posts
function so_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.', 'wptips') . '</div><br />';
Posted in Wordpress


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

No Trackbacks.


Register | Lost your password?
0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×