List archives for a specific category using wp_get_archives() in WordPress


add 'cat=5' (with the number “5″ being the id of the category you want to include)I’m currently creating an archives page for the new Seasiders Podcast wordpress theme and  on this page I wanted to display a list of all the previous podcast episodes.  I have assigned a category of ‘podcasts’ to each blog post I published which contained podcast episode content.

I thought to myself, “This should be quite straighfoward to achieve by using WordPress function wp_get_archives()” – wrong!!!  For some reason, this function doesn’t support this functionality (no pun intended!) of allowing us to include or exclude categories by default.

Anyway, Ive found a way around this:

I  found  a plugin called Archives for a category which adds these capabilities to the function.

  1. Download and install the Archives for a category plugin
  2. Open your PHP page/post template
  3. Paste in ‘type=postbypost&cat=5’ (with the number “5″ being the id of the category you want to include) as a parameter of the function, in between the parenthesis, it will look like this code snippet:

NB – you need to add the argument ‘type=postbypost’ to display the individual post titles or else it will just display Category Month

Contact Me