Hello guys,
I was hoping to get some ideas as how I can get a number of posts that have been posted on our blog BUT within a certain date range. I know how to get total number but need this extra functionality.
This is what I have for getting total number of posts:
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts);
Then I just echo out where ever I want to display that number
<?php if ( is_page('wordpress-numbers')) {
echo "<strong>".$numposts.' posts have been published since August 12, 2009'."</strong>";
}
?>
For example I want to know the number of posts in the last 7 days. Maybe use a datepicker of sorts?
Thanks,
Matt