Queried Post Count for Year - How to Do Other Post Count Queries? (1 post)

  1. markey101101
    Posted 5 years ago #

    This Year <?php echo $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND <code>post_date</code> > '" . date("Y") . "-01-01 00:00:00'");
    if (0 < $numposts) $numposts = number_format($numposts); ?>

    That code queries the post count for the current year.

    I' wondering how to do it for day then week then month?

    All help is highly appreciated. I am an absolute PHP noob and totally surprised I actually go this far.

Topic Closed

This topic has been closed to new replies.

About this Topic