hi,
i'm trying to use the categories as a navigation. So far i got the subcategories showing nicely when on a parent or sibbling in the sidebar using this 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.'</a>
</li>';
}
echo "<ul>$items</ul>";
}
unset($subcategories,$subcat,$thiscat,$items);
}
?>
which I got from this thread: http://wordpress.org/support/topic/showing-subcategories-of-a-parent-page-under-subcategory
big thanks to t31os_ !
my problem now is that the subcategories still need to show when viewing the individual posts. tried the code from akis but it doesn't work for me.
quite new to this so pl keep answers simple, thanks!