Search code examples
wordpresscategoriesarchive

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


Solution

  • 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.