Custom navigation / menu output (walker?)

This should do it for you.. (UNTESTED) Create a file in your theme folder called nav-menu-walker.php and include this file in your theme functions.php file. nav-menu-walker.php class My_Nav_Menu_Walker extends Walker_Nav_Menu { function start_el( &$output, $item, $depth = 0, $args, $id = 0 ) { $indent = ( $depth ) ? str_repeat( “\t”, $depth ) : … Read more

Custom walker pulldown display current page

WordPress add “current-menu-item” class for the active menu item, you could check if this class is set and the set the option for that item be selected. class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu { function start_lvl($output, $depth) { } function end_lvl($output, $depth) { } function start_el($output, $item, $depth, $args) { // Here is where we create each … Read more

how to make a walker to this (in bootstrap, i try but not work)

I use this navwalker <?php class wp_bootstrap_navwalker extends Walker_Nav_Menu { public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat( “\t”, $depth ); $output .= “\n$indent<ul role=\”menu\” class=\” dropdown-menu\”>\n”; } public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth … Read more