Support » Fixing WordPress » Display how many posts were published within last 24 hours

Viewing 1 replies (of 1 total)
  • If i understand you, you want to display number of the posts published within a day ? Here is example:

    <?php
    $last_24 = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = 'publish' AND TIMEDIFF(NOW(), post_date) < '24'");
    echo $last_24;
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Display how many posts were published within last 24 hours’ is closed to new replies.