Revision: 30469
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 14, 2010 04:43 by pitrih
Initial Code
<?php if(is_category()) { $breakpoint = 0; $thiscat = get_term( get_query_var('cat') , 'category' ); $subcategories = get_terms( 'category' , 'parent='.get_query_var('cat') ); if(empty($subcategories) && $thiscat->parent != 0) { $subcategories = get_terms( 'category' , 'parent='.$thiscat->parent.'' ); } $items=''; if(!empty($subcategories)) { foreach($subcategories as $subcat) { if($thiscat->term_id == $subcat->term_id) $current = ' current-cat'; else $current = ''; $items .= ' <li class="cat-item cat-item-'.$subcat->term_id.$current.'"> <a href="'.get_category_link( $subcat->term_id ).'" title="'.$subcat->description.'">'.$subcat->name.' ('.$subcat->count.')</a> </li>'; } echo "<ul>$items</ul>"; } unset($subcategories,$subcat,$thiscat,$items); } ?>
Initial URL
http://wordpress.org/support/topic/showing-subcategories-of-a-parent-page-under-subcategory
Initial Description
Initial Title
List subcategories in wordpress
Initial Tags
Initial Language
PHP