Hey guys. I'm using WP as a CMS for a site and I'm using categories and subcategories for the basic structure of the site.
IE:
About Us (main category)
-Directions (sub cat)
-Contact Us (sub cat)
Groups (main category)
-Men's group (sub cat)
-Women's group (sub cat)
-Teens (sub cat)
My question is how do I get the list of subcategories to only appear under its parent? I did this with creating custom category template + custom sidebar file but that's way too much files.
I also used this PHP code to do the same. The only problem is that this only shows the subcats in their parents, but once I click into a subcategory, the list of links disappear.
<?php
if (is_category()) {
$this_category = get_category($cat);
if (get_category_children($this_category->cat_ID) != "") {
wp_list_categories('orderby=order&show_count=0&title_li=
&use_desc_for_title=0&hide_empty=0&child_of='.$this_category->cat_ID);
}
} ?>
I want to keep using this PHP file but how do I use it so that it shows the list of subcats even though I'm in one of the subcats?
I hope that made sense.