Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • You could do that via mySQL. Something like:

    global $wpdb;

    $last_day_of_this_month =
        date('d',
            mktime(0, 0, 0,
            the_time('m') + 1,
            0, the_time('Y'))
        );

    $this_month_begin =
        the_time('Y') . '-' .
        the_time('m') . '-01';
    $this_month_end =
        the_time('Y') . '-' . the_time('m') . '-' .
        $last_day_of_this_month;

    $this_month_post_count =
        $wpdb->get_var(
            "SELECT COUNT(*)
            FROM $wpdb->posts
            WHERE post_date BETWEEN this_month_begin AND $this_month_end
            AND post_status = 'publish'"
        );

    Though I haven’t tested this.

    I asked this question. I should have registered first, but the message is no longer annonymous.

Viewing 2 replies - 1 through 2 (of 2 total)