How to determine which years there are posts for in a category?
-
Hi,
How can I determine which years there are post for in a particular category? I’ve stumbled across the following database query in the codex, but I can’t figure out how to add a category condition (given the new terms tables and all).
$wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date DESC");
Can anyone suggest a solution? Perhaps there is a way to do this without the custom database query?
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to determine which years there are posts for in a category?’ is closed to new replies.