I want to show list of the subcategories when you click on the parent category page. I will be really grateful if someone can help me.
1 Answer
This code checks if you're on a category page, and if so it lists all the categories that are children of the current category.
if (is_category()) {
$this_category = get_category($cat);
if (get_category_children($this_category->cat_ID) != "") {
wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID);
}
}