Hello,
let's assume I have one main-category called "Miscellaneous" and some sub-categories. There are no articles at all, yet.
Accessing exaple.com/category/miscellaneous/ leads to "Nothing Found".
How can I achieve that it lists the sub-categories instead?
Kind regards
Hugo
in category.php, where the 'nothing found' text is (that is the 'else :' part of the 'if(have_posts()) :' conditional statement), add something like:
<?php $subcats = wp_list_categories('echo=0&child_of=' . get_query_var('cat'));
if($subcats) { ?>
<ul>
<?php echo $subcats; ?>
</ul>
<?php } else { echo 'nothing found'; } ?>
details depend on the category.php template file of the theme.
Thank you very much!
Is this going to work with TwentyTen?
you need to find the corresponding area in loop.php, and probably make it conditional on is_category()
it is this section you need to rework (near the beginning of loop.php):
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->