I'm looking for an if statement to check if the post has been made in the last 30 days. if not, for it to post a message at the end of the post saying it's an old post.
I'm looking for an if statement to check if the post has been made in the last 30 days. if not, for it to post a message at the end of the post saying it's an old post.
<?php
$mylimit = 46 * 86400; //days * seconds per day
$post_age = date('U') - mysql2date('U', $post->post_date_gmt);
if ($post_age < $mylimit) {
echo 'this post was made in the last 46 days ';
}
?>heelo! Do you know how to display total number of posts published today ?
<?phpdo not work
$post_date = mysql2date("Ymd", $post->post_date_gmt);
$numpost = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' And post_date==post_date_gmt");echo $numpost;
?>
This topic has been closed to new replies.