0
votes

I finally got some code made for to output this years total published posts.

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

I'm looking at the WP time paramters to try and make it also do day then week then month.

http://codex.wordpress.org/Function_Reference/query_posts#Time_Parameters

Can anyone advise me on what to do? Thanks

1

1 Answers

0
votes

I think this thread should help you along.

This Query will give you the number of posts by year and month.

SELECT YEAR(post_date) as yer, MONTH(post_date) as mnth, COUNT(post_date) as num
FROM your_table
WHERE post_status = 'publish' 
GROUP BY YEAR(post_date), MONTH(post_date)