Display WordPress Archives one category at a time?

I am almost done with my humble attempt at a custom CMS using WordPress. The only difficulty I have is making a page display the archive for only one category (and it’s children). Anyone has an idea?
Thanks a lot!
Regis

Related posts

Leave a Reply

2 comments

  1. You can create your own custom archive page using the class WP_Query. Specifically, something like:

    <?php $query = new WP_Query('category_name=code'); ?>  
    <?php while ($query->have_posts()) : $query->the_post(); ?>
    <!-- display the category here --> 
    <?php endwhile; ?>
    

    You can look at the default theme’s archive.php to get a feel for what else is needed to display a particular category in a layout you are familiar with.

  2. This is what I use to show a list of titles and permalinks for the category “mycategory”; this can go inside the main WordPress loop:

    <?php $my_query = new WP_Query('category_name=mycategory&showposts=-1'); ?><?php while ($my_query->have_posts()) : $my_query->the_post(); ?><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><?php endwhile; ?>
    

    Change the “-1” to “1” to show only the one most recent post; to “10” to show the last 10 posts, etc.