Hi Again,
Ok I think I’m making some headway with this. However, I’m confused with one part. I’ve my page called category.php. I’ve added some code to show the sub categories, however, I can’t work one thing out.
How do I show posts only for a given category or sub category?
I’ve a section called Archive News, this would use category.php and should then show the sub categories, in this case:
feb – mar 2010
dec – jan 2010
oct – nov 2009
If you click the date (above) it then shows a list of article titles.
Here’s my code:
<h1><?php single_cat_title(); ?></h1>
<h2>This is category.php - used to show category content only</h2>
<?php
# LIST ALL SUB-CATEGORIES FOR A GIVEN CATEGORY
if (is_category()) {
$this_category = get_category($cat);
if (get_category_children($this_category->cat_ID) != "") {
#echo "<h1>Subcategories</h1>";
echo "<ul>";
wp_list_categories('orderby=id&show_count=0&title_li=
&use_desc_for_title=1&child_of='.$this_category->cat_ID);
echo "</ul>";
}
}
?>
<hr />
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_excerpt('Read the rest of this entry »'); ?>
<?php #the_content('Read the rest of this entry »'); ?>
</div>
</div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>
<?php endif; ?>
I hope this makes sense? At present category.php lists the sub categories and the posts
Thanks