0
votes

I have a jsfiddle.net/vanduzled/AgAwK/ of what it turns out the output of wp_list_categories:

So I have A list of Category in wordpress with a sub category and I want it to display in my sidebar. I use wp_list_categories but what it displays is like this:

Accessories

  • Sub Accessory

Lifestyle Products

  • Sub Lifestyle Products

This looks good but I want to make the children (ie Sub Accessory) hidden and when you hover on the Parent (ie Accessories) the children will come out on the side like a normal vertical navigation with a Two Level Layout.

In my fiddle, the class .children is hidden and I put inline-block on when you hover on the parent but it doesn' work.

I'm actually using a Foundation Framework and Zurb has a Navigational Menu built in already but I can't use it in the dynamic insertion of menus as if to use a custom walker and then style is as necessary because in Foundation, they have an extra class which I cannot put in the wp_list_category function of wordpress.

I don't know if this can be done with pure css or a js will be necessary.

1

1 Answers

0
votes

You can use a traditional css in doing this from A list Apart:

/* ASDIE NAV*/

ul.side-nav { display: block; list-style: none; margin: 0; padding: 17px 0; }
ul.side-nav li { display: block; list-style: none; }


.children{
  width: 200px;
  position: relative;
  z-index: 1;
  border-bottom: 1px solid #ccc;
}

ul.side-nav {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 220px; /* Width of Menu Items */
  border-bottom: 1px solid #ccc;
  }

ul.side-nav li {
  position: relative;
  }

.side-nav li ul {
  position: absolute;
  left: 199px; /* Set 1px less than menu width */
  top: 0;
  display: none;
  }

/* Styles for Menu Items */
ul.side-nav li a {
  display: block;
  text-decoration: none;
  color: #777;
  background: #fff; /* IE6 Bug */
  padding: 5px;
  border: 1px solid #ccc;
  border-bottom: 0;
  }

/* Fix IE. Hide from IE Mac \*/
* html ul li { float: left; height: 1%; }
* html ul li a { height: 1%; }
/* End */

ul.side-nav li a:hover { color: #E2144A; background: #f9f9f9; } /* Hover Styles */

li ul.side-nav li a { padding: 2px 5px; } /* Sub Menu Styles */

ul.side-nav li:hover ul.children, ul.side-nav li.over ul.children { display: block; } /* The magic */

/* ASIDE !NAV */