Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Here is what i want to do: For a specific date i want the number of posts from a certain tag.

For example: on 14th March i have a certain number of posts tagged "jazz". I want to plot that number on y-axis of a chart (dont worry about how i make the chart, i just want to get the number) and the corresponding date on x-axis. Hence showing a graph of posts tagged 'Jazz' over time.

i just need two variables: the number of posts from a specific tags and the corresponding date.

Ive searched but i could not find any plugin for that. How should i go about it? Thank you :)

share|improve this question
    
When you say "searched", have you searched here? –  brasofilo Mar 13 '13 at 20:11
    
yessir. nothing found :/ –  waqas Mar 13 '13 at 21:28
    
No prob, it's just nice to state that in Question itself, so we know about your research efforts. Anyway, there's an interesting Answer down here, make sure you test the solution and provide feedback to the answerer. Welcome, btw! –  brasofilo Mar 13 '13 at 21:35
2  
ive been silently reading SE for years(?) now (thanks to google) and this is the first time ive asked anything. i know i shudnt ask unless ive searched as thoroughly as i am capable of. will definitely reply to @kovshenin after i test it out at work tomorrow. and thanks :) –  waqas Mar 13 '13 at 22:02
add comment

2 Answers 2

You can do that with a custom SQL query, something along the lines of:

global $wpdb;
$results = $wpdb->get_results( "SELECT DATE(post_date) AS d, COUNT(*) AS c FROM $wpdb->posts WHERE post_status = 'publish' GROUP BY d" );

You'll get an array of objects where d is the date and c is the number of posts published on that date. You should also put LIMIT constraints if you plan to query large datasets.

Hope this helps.

share|improve this answer
add comment

Just asking the same question myself, and i found this guy: digwp.com/2011/04/graphing-blog-comments-over-time

he's doing something slightly more complicated (graphing the number of comments per post per day), but starting with a very similar query to kovshenin and drawing a neat little css graph. It's not a complete module, but he's made all his code available.

share|improve this answer
    
Can you provide a bit more of a technical answer. Link only answers aren't usually considered quality answers. If the link becomes inactive, the answer becomes benign. –  Brian Fegter Apr 8 '13 at 6:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.