List Sub-Categories on Category Page
-
Hi! I have changed my category pages to category landing pages by using the Category Page plugin. Simply put my category pages now have content on each page (as opposed to a list of articles in that category).
I am currently using a category specific loop (loop_category.php) to list other existing articles in the chosen category below the content on the category page as “Related Articles”, but would also like to be able to list existing sub-categories of the chosen category as well but am not quite sure hot to. Any help is greatly appreciated!
My existing code to show posts belonging to the chosen category:
<?php /* Check if there are posts */ if ( have_posts() ) { /* Post index for semantic classes */ $post_index = 1; ?> <?php // tr - the following 3 lines list only category posts and exclude sub-category posts $cat = intval( get_query_var('cat') ); ?> <?php while (have_posts()) : the_post(); ?> <?php if ( in_category($cat) ) { ?>
- The topic ‘List Sub-Categories on Category Page’ is closed to new replies.