Support » How-To and Troubleshooting » Make Subcategory Dissappear (If None)

Make Subcategory Dissappear (If None)

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

    Example: http://citizen.nfb.ca/blogs/category/citizenshift/

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

    Example: http://citizen.nfb.ca/blogs/category/podcasts/

    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.