views:

1344

answers:

2

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

+1  A: 

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.

Andrew Austin
A: 

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.

songdogtech