WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Show child of current category

[Resolved] Show child of current category

  • Hi guys, this is my second sidebar where I list subcategories of category #18, how can I show make it dynamic and show subcategories list of current category instead ?Attempts not successful up to now…

    <div id="sidebar">
    <?php
    wp_list_categories('orderby=id&use_desc_for_title=1&depth=1&hierarchical=1&hide_empty=0&child_of=18');
    ?>
    </div>

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Like this?

    <?php
    if (is_category()) {
    $cat = get_query_var('cat');
    wp_list_categories('orderby=id&use_desc_for_title=1&depth=1&hierarchical=1&hide_empty=0&child_of='.$cat);
    }
    ?>

    Yihoo!
    I had tried same query found in another post but forgot the dot before $cat, big thank you Michael!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Show child of current category’ is closed to new replies.