If you want to only display sub-categories based on selected Parent Category? Thanks for your help. I was able to get it to work by adding the following code:
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php if (is_category()) { $cat = get_query_var('cat'); $this_category = get_category($cat); $this_category = wp_list_categories('hide_empty=0&hierarchical=true&orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID."&echo=0"); if($this_category !='<li>No categories</li>') { echo '<h3>Products</h3>'; echo '<ul>'.$this_category.'</ul>'; } } ?> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.