• 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?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 ?

    <?php
    $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;
    ?>
    do not work

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If post_date is old then display txt’ is closed to new replies.