Limit WP_get_archives by category?

I have two categories on a site – news which contains news posts and blog – which contains blog posts. Each page has a wp_get_archives in the sidebar. I’d like to limit the archive listing by category but after looking at the codex this does not seem possible. http://codex.wordpress.org/Function_Reference/wp_get_archives

<?php wp_get_archives('type=monthly&limit=12'); ?>

That code lists the archives for all the posts, but I want to list archives for just that category. Am I using the wrong function? Or is this not possible?

Related posts

Leave a Reply

4 comments

  1. Basically this is possible, but somewhat messy. This function relies on direct SQL query to database, which you can change via getarchives_where and getarchives_join filters.

  2. I use this code on my site to pull from a specific category (this is in the sidebar – shows just my ‘blog’ posts and not my ‘portfolio’ posts):

    <ul>
    <?php
    global $post;
    $myposts = get_posts('numberposts=10&category=3&order=DESC');
    foreach($myposts as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul> 
    
  3. i am not sure if this workaround will do :
    if instead of the archive you use RSS and specify for the RSS the number of post titles to be shown.

    it is easy to get the RSS of the category – easy to specify nbre of posts.

    no ? would it work ?