nickberens360
10/26/2016 - 1:49 PM

wp if post is older than published date

wp if post is older than published date

//Functions file
function is_old_post($days = 5) {
	$days = (int) $days;
	$offset = $days*60*60*24;
	if ( get_post_time() < date('U') - $offset )
		return true;
	
	return false;
}

//Usage
if ( is_old_post(10) ) {
	// do something if the post is old
} else {
	// do something if the post is not old
}