I was trying to filter wp_get_archive() by category in category.php.
I having 2 categories say “a” and “b”, i want the date listing on both categories separately,
which means category “a” page must contain the posts dates listing only within that category and similarly on category “b” page too.
Now am getting all posts date listing on both categories.
<?php
echo "<ul>";
wp_get_archives('type=yearly');
echo "</ul>";
?>
There is a really usefull plugin made by Rob Schlüter that does exactly what you want to do (it is not achievable by default with
wp_get_archives
– the other way, without plugin, would be to do a custom query but it would be a bit overkill).First, download the plugin in your plugins folder, activate it, then in your template you will be able to do this:
Where
1
is the ID of your category.