What I would like to achieve is this:
If no children categories exist show post titles in the active category else show children categories.
This is a excerpt from the category.php template:
<h1><?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?></h1>
<h2>Table of contents</h2>
***(A)***
<ul><?php echo wp_list_cats('child_of='.$cat);?>
</ul>
***(B)***
<?php query_posts($query_string .
'&orderby=title&order=asc&posts_per_page=-1');?>
<?php if (have_posts()) : ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.
Where (A) and (B) in the code somehow have to be combined to a statement(?)
Also how do I get rid of the 'no categories' statement that show when there are no categories?
Has anyone tackled this before, or know how to do this?
Many thanks :-)