I want to add a specific text in single.php for the posts that are more than 1 month old. How can I do that ?
I want to add a specific text in single.php for the posts that are more than 1 month old. How can I do that ?
It should be something like this. Add it to single.php file:
$months_earlier = time() - 30*24*60*60;
$post_published = get_the_time('U');
if($months_earlier > $post_published){
// this is a 30 days old post. Echo your message here.
}
Used: http://codex.wordpress.org/Function_Reference/get_the_time
thnks it helped :-)
You must log in to post.