Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to show list like:

  • category 1
    • sub cat 1.1
    • sub cat 1.2
    • sub cat 1.3
  • category 2
  • category 3

My code is:

<div class="f1" ><p class="heading">Links</p><?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 '<ul>'.$this_category.'</ul>'; 
                    }
                }
                ?>
            </div> 
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.