Make Subcategory Dissappear (If None) (1 post)

  1. robmaguire
    Posted 8 years ago #

    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 } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic