<?php
require_once dirname(__FILE__) . '/wp-bootstrap-navwalker/wp-bootstrap-navwalker.php';
function the_menu($menu = null, $class = null, $wrapper = null)
{

	$id = null;

	$defaults = array(
		'theme_location'  => '',
		'menu'            => $menu,
		'menu_class'      => 'dropdown',
		'container'       => '',
		'container_class' => '',
		'container_id'    => '',
		'echo'            => false,
		'fallback_cb'     => 'wp_page_menu',
		'before'          => '',
		'after'           => '',
		'link_before'     => '',
		'link_after'      => '',
		'items_wrap'      => '<ul ' . ($class ? 'class="' . $class . '"' : '') . '>%3$s</ul>',
		'depth'           => 0,
		'walker'          => new wp_bootstrap_navwalker(),
	);
	$menu = wp_nav_menu($defaults);
	//$menu = str_replace('sub-menu', 'dropdown-menu', $menu);
	//$menu = str_replace('menu-item-has-children', 'dropdown', $menu);
	return $menu;
	//wp_nav_menu($defaults);
}

function footer_menu($menu, $class)
{
	$defaults = array(
		'theme_location'  => '',
		'menu'            => $menu,
		'menu_class'      => 'dropdown',
		'container'       => '',
		'container_class' => '',
		'container_id'    => '',
		'echo'            => false,
		'fallback_cb'     => 'wp_page_menu',
		'before'          => '',
		'after'           => '',
		'link_before'     => '',
		'link_after'      => '',
		'items_wrap'      => '<ul class="' . $class . '">%3$s</ul>',
		'depth'           => 0,
	);
	return wp_nav_menu($defaults);
}

class My_Walker_Nav_Menu extends Walker_Nav_Menu
{

	function start_lvl(&$output, $depth = 0, $args = [])
	{
		$indent = str_repeat("\t", $depth);
		if ($depth == 0)
			$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
		else
			$output .= "\n$indent<ul class=\"dropdown-submenu\">\n";
	}

}
 