/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if(is_category()) { $breakpoint = 0; $thiscat = get_term( get_query_var('cat') , 'category' ); $subcategories = get_terms( 'category' , 'parent='.get_query_var('cat') ); $subcategories = get_terms( 'category' , 'parent='.$thiscat->parent.'' ); } $items=''; 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>"; } } ?>
URL: http://wordpress.org/support/topic/showing-subcategories-of-a-parent-page-under-subcategory