I am creating custom Wordpress theme using a starter theme _Underscores. I am also using Bootstrap as a front-end framework.
I would like to modify wp_nav_menu so th
In header.php insert this code to show menu:
'menu-one',
'walker' => new Custom_Walker_Nav_Menu_Top
)
);
?>
In functions.php use this:
class Custom_Walker_Nav_Menu_top extends Walker_Nav_Menu
{
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$is_current_item = '';
if(array_search('current-menu-item', $item->classes) != 0)
{
$is_current_item = ' class="active"';
}
echo '- '.$item->title;
}
function end_el( &$output, $item, $depth = 0, $args = array() ) {
echo '
';
}
}