0

I want to have 3 menus of categories, and each menu with diferent level of categories.

First menu with First level categories:

  • category 1
  • category 2
  • category 3

If I go to the first category, I want to show a second menu under de first one with child categories of current category:

  • subcategory 1.1
  • subcategory 1.2
  • subcategory 1.3

And finally, if I go to subcategory 1.1, I want to show a new menu with child categories of current subcategory:

  • subsubcategory 1.1.1
  • subsubcategory 1.1.2
  • subsubcategory 1.1.3

1 Answer 1

0

wp_list_categories(); will by default give you a hierarchically nested list of all your categories. Hiding and showing that list, or parts of it, is just a matter of CSS. That sounds like what you need. For example

echo '<ul class="my-cats-list">',wp_list_categories(),'</ul>';

// style rules; put in your theme's style.css
.cat-item {
  padding-left:5px;
}
.children {
  display:none;
}
.cat-item:hover>.children {
  display:block;
}

That is very minimal but does work.

5
  • Hi!But I want separate menus not in the same list.
    – Mike
    Apr 21, 2013 at 14:39
  • I don't know what that means. Are you talking about clicking a menu and then going to another page for the second menu?
    – s_ha_dum
    Apr 21, 2013 at 14:41
  • For example, when I click in a category of the first menu, I will show the first menu and the second menu with his child categories
    – Mike
    Apr 21, 2013 at 14:45
  • That is almost what I did. Replace the > in the last rule with a space and that is what you should have. But I suspect that you are still not being clear about what you want. Please edit the question with much more detail.
    – s_ha_dum
    Apr 21, 2013 at 14:48
  • I want separate menus in diferente divs
    – Mike
    Apr 21, 2013 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.