WordPress > wp_list_categories with no child categories listed -


The script below creates a list of categories in the site (except in "Uncategorized")

If possible, I would like to modify it so that it does not list only the top level categories (any child categories) ...

I thought "depth" = 1 would argue but Not so it lists all the categories when I remove the "hierarchical" girl, then it The child excludes the categories, but it also includes the category "Extra classified" which I'm clearly excluding via the exclusion_true = 1 argument.

Testing on Wordpress 3.0.1 on damage.

  $ cat_args = array ('orderby' = & gt; 'name', 'show_count' => $ c, 'hierarchical' = & gt; $ h); $ Cat_args ['title_li'] = '; $ Cat_args ['exclude_tree'] = 1; $ Cat_args ['Depth'] = 1; Wp_list_categories (apply_filters ('widget_categories_args', $ cat_args));  

Add this $ cat_args ['child_of'] = 0; ['Depth'] = 1; with combination of $ cat_args

This will only generate root category o

  $ cat_args = array ('orderbay' = & gt; 'name', 'showcount' => ; $ C, 'hierarchical' = & gt; $ h); $ Cat_args ['title_li'] = '; $ Cat_args ['exclude_tree'] = 1; $ Cat_args ['Depth'] = 1; $ Cat_args ['child_of'] = 0; Wp_list_categories (apply_filters ('widget_categories_args', $ cat_args));  

Comments