List current post similar categories

AeroSFX

New Member
I have this structure:When i'm on a category it shows the list of its relative categories that are child of a parent category:--Category 1Category 2Category 3--I list it with this code:\[code\]<?php if (is_category()) { $this_category = get_category($cat); } if($this_category->category_parent) $this_category = wp_list_categories('orderby=id&title_li=&child_of='.$this_category->category_parent."&echo=0"); else $this_category = wp_list_categories('orderby=id&title_li=&child_of='.$this_category->cat_ID."&echo=0"); if ($this_category) { ?> <ul class="sub-menu"> <?php echo $this_category; ?> </ul> <?php } ?>\[/code\]The problem is that when I enter to a post of one of those categories it only displays the current category of the post, not the relative categories of it:--Category 1--I'm using the same code I pasted above to list the categories in the single.php file, but it still only shows the current category of the post i'm viewing.How can I get to list the relative categories (that belong to a parent category) of the current post category? What i'm doing wrong?
 
Back
Top