WordPress.org

Support

Support » Plugins and Hacks » If post_date is old then display txt

If post_date is old then display txt

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.
Skip to toolbar