wordpress | Programming Assignment Help Sites | November 20th, 2021
showing subcategories on WordPress category pages
show the subcategories for a given category on it’s category page .Basically you need to check whether there are any children, and if there are, list the categories with the current category as a parent or grandparent. The following code does just that:
if (is_category()) { $this_category = get_category($cat); if (get_category_children($this_category->cat_ID) != "") { echo "Subcategories
"; echo ""
; wp_list_categories('orderby=id&show_count=0&title_li= &use_desc_for_title=1&child_of='.$this_category->cat_ID); echo ""; } }