Show child categories of current category page
-
Hi,
I want to display child categories of current category in category page. I have a code
<?php if (is_category()) { $this_category = get_category($cat); } ?> <?php if($this_category->category_parent) $this_category = wp_list_categories('orderby=id&show_count=0 &title_li=&use_desc_for_title=1&child_of='.$this_category->category_parent. "&echo=0"); else $this_category = wp_list_categories('orderby=id&depth=1&show_count=0 &title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID. "&echo=0"); if ($this_category) { ?> <ul> <?php echo $this_category; ?> </ul> <?php } ?>
I think it works perfect for default post categories. But i want to use it in custom post type categories. How to do that?
register_taxonomy(__('recipe-category'),'recipe',array( 'hierarchical' => true, 'labels' => $labels, 'with_front' => false, 'rewrite' => array( 'slug' => 'receptai' ),
I hope you understand me ??
- The topic ‘Show child categories of current category page’ is closed to new replies.