• Hello,

    I am trying to extend the way wp_nav_menu works by creating a simple walker yet I am having difficulties with it.

    Here is the class:

    class Walker_Menu_Float extends Walker_Nav_Menu {
    	function end_lvl(&$output, $depth) {
    		$indent = str_repeat("\t", $depth);
    		$output .= $indent . '<li class="float-divider">&nbsp;</li></ul>\n';
    	}
    }

    As you may see I have added a very minor details yet when I use this in my theme I dont see this addition added to my code.

    I tried modifying other functions, start_el, end_el and they work but this one doesnt.

    Here is the code in the theme:

    $walker = new Walker_Menu_Float();
    
    wp_nav_menu(array(
    	'menu' => 'Pests',
    	'container' => null,
    	'menu_id' => 'menu-pests',
    	'theme_location' => 'menu-pests',
    	'walker' => $walker
    ));

    Any help is highly appreciated.

    Thank you.

    Alexander

  • The topic ‘Using a Walker on Menu’ is closed to new replies.