Dropdown Carret to Parent menu

Hi I have a custom menu and I am trying to expand and collapse the menu instead of showing them all at once. http://54.172.86.136/

I found this code to put in my functions but its not working:

// add arrows to menu parent 
function oenology_add_menu_parent_class( $items ) {
 
 $parents = array();
 foreach ( $items as $item ) {
 if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) {
 $parents[] = $item->menu_item_parent;
 }
 }
 
 foreach ( $items as $item ) {
 if ( in_array( $item->ID, $parents ) ) {
 $item->classes[] = 'has-children';
 }
 }
 
 return $items;
}
add_filter( 'wp_nav_menu_objects', 'oenology_add_menu_parent_class' );

CSS:

.menu li.has-children > a:after {
 color: #fff;
 content: ' ▼';
 font-size: 10px;
 vertical-align: 1px;
}
.menu li li.has-children > a:before {
 color: #222;
 content: ' ►';
 font-size: 10px;
 vertical-align: 1px;
}


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.