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

WPEC Category Collapse / Expand WordPress

  • SOLVED

Hi!

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)

2011-12-14

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: http://wordpress.org/extend/plugins/collapsing-categories/screenshots/ 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="http://ken.ph/wp-e-commerce-expandablecollapsible-menu/"]]http://ken.ph/wp-e-commerce-expandablecollapsible-menu/[[/LINK]]
* [[LINK href="http://www.eclipse-creations.com/blog/other/collapsing-categories-in-wp-e-commerce/"]]http://www.eclipse-creations.com/blog/other/collapsing-categories-in-wp-e-commerce/[[/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?