ribamar23
Member
Posted 1 year ago #
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
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.wordpress.org/Template_Tags/wp_list_categories
http://codex.wordpress.org/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
ribamar23
Member
Posted 1 year ago #
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