• ribamar23

    (@ribamar23)


    Hi

    I’m newbie in PHP and WordPress.

    I want to list all the categories with depth = 1.

    wp_list_categories('hide_empty=0&depth=1');

    Ok it worked

    Now I want when a user clicks a category if it has child categories a new panel next to original one becomes visible with all the child categories, and so on, untill user reaches a category that has no childs.

    Can anyone help please?

    cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    this should show all direct child categories of the current category in the category archive page:

    <?php if( get_categories('parent='.get_query_var('cat')) ) echo '<ul>'.wp_list_categories('hide_empty=0&depth=1&child_of='.get_query_var('cat').'&echo=0').'</ul>'; ?>

    http://codex.ww.wp.xz.cn/Template_Tags/wp_list_categories
    http://codex.ww.wp.xz.cn/Function_Reference/get_categories

    for any problems with ‘a new panel next to original one becomes visible’, please post a link to your site for more suggestions

    Thread Starter ribamar23

    (@ribamar23)

    I need to place a category selector anywhere where first I only get the top parent categories and then i select one and see the childs…. and so on untill i get to final category…..

    it’s for a auction website when user is listing an item and has to choose its category

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Category List’ is closed to new replies.