Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WPEC Category Collapse / Expand WordPress



The category widget is showing all of the categories (both top level and second level) in one long list. Is it possible to hide the second level categories, and make them expand when you click the respective top level category – just like a normal menu would work?

Answers (1)


Francisco Javier Carazo Gil answers:

Hi brzzz,

If you want only show the first level you can use the next:

<?php wp_list_categories('title_li=&hierarchical=0&depth=1');?>

Now I have to look how to make you able to expand/collapse.

brzzz comments:

Hi Francisco,

where do i need to put this code? Sorry for asking this question.

Francisco Javier Carazo Gil comments:

In your sidebar.php you should have a call to: wp_list_categories() function.

You should change the old one for this one.

Francisco Javier Carazo Gil comments:

I think it is easier: look at it.

This plugin is what you want.

brzzz comments:

The problem is, that this plugin does not work with WP E-commerce. I only need this feature for WP E-Commerce, because i will have many categories.

Francisco Javier Carazo Gil comments:

Ah ok, look at this two links:
* [[LINK href=""]][[/LINK]]
* [[LINK href=""]][[/LINK]]

Hope it helps!

brzzz comments:

i installed this one: wp-e-commerce-expandablecollapsible

it kinda works; but do you know how to change the code, so there is no more "+" or "-". I want that i can click on the PARENT and then it expands it. Do you know what i mean?