I need some help customizing a walker function. I don't fully undrestand it, but it's helped me get half of what I need.
class themeslug_walker_nav_menu extends Walker_Nav_Menu {
// add classes to ul sub-menus
function start_lvl( &$output, $depth ) {
// depth dependent classes
$indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
$display_depth = ( $depth + 1); // because it counts the first submenu as 0
$classes = array(
' dropdown',
/*?>( $display_depth % 4 ? ' ' : '' ),
( $display_depth >=4 ? '' : '' ),
'-' . $display_depth<?php */
);
$class_names = implode( ' ', $classes );
// build html
$output .= "\n" . $indent . '<ul class="' . $class_names . '">' . "\n";
}
}
Here is what I have so far, and it works great to add a submenu to the ul at the 2nd and third levels. I need to figure out how to add a custom class to the parent ul. I can do it in query but it's not quite the solution I would like. Any help is appreciated.