Support » Fixing WordPress » Make Subcategory Dissappear (If None)

  • robmaguire


    On our site, whenever one is looking at a category page, WP lists the subcategories on the left hand side


    However, whenever the category does not have subcategories, the subcategory header is still listed.


    How would I go about coding something that says to WP “If there are no subcategories for this category, do not show the subcategory header” ?


    Here is the relevant code from the sidebar:

    <?php if ((is_category())||(is_single())) { ?>
    	<?php if($parent_category->cat_name == '') { ?>
    		<?php wp_list_cats('child_of='.$this_category->cat_ID); ?>
    		<?php } else { ?>
    		<?php wp_list_cats('child_of='.$parent_category->cat_ID); ?>
    		<?php } ?>
  • The topic ‘Make Subcategory Dissappear (If None)’ is closed to new replies.