The functionality to display archives for a particular category is strangely not part of WordPress default functionality, despite a Google search revealing many questions relating to this functionality.
If you’re one of these people asking for help on this topic, you’ve come to the right place as we have finally found the solution in the form of a plugin aptly named Archives for a Category.
After installing this plugin you will now be able to display archives for one category by using the following code:
[php]wp_get_archives(‘cat=1’);[/php]
To build a sidebar which detects the category automatically and displays the archives, you cna use the following code:
[php]
$cat_ID = get_query_var(‘cat’);
wp_get_archives("cat=$cat_ID");
[/php]
If you enjoyed this post, make sure to subscribe to WPMayor’s RSS feed.