Custom sidebar category listing?

You can skip categories that have parent in your loop:

foreach($category_list as $category) {

if( '0' != $category->parent )
    continue;

I’ve looked through the source, but it seems depth is only taken in account in wp_list_categories() and you will probably need to extend Walker_Category class to custom walker there to make changes to output.

Actually, this might be a good idea if you need a really complex categories output format.

Leave a Comment