Sometimes you just need 100% control over your WordPress menus.
Calling wp_nav_menu() directly has its place, but typically your walker function that might generate a Bootstrap compatible main menu might not be ideal for a footer, location selection, or sidebar link list.
Using wp_get_nav_menu_items() will give us access to every part of the menu object. Title, Link, Class name, and window location.
<ul> <? $location_menu = wp_get_nav_menu_items('Custom Menu'); foreach ($location_menu as $location): ?> <li><a href="<?= $location->url ?>"><?= $location->title ?></a></li> <? endforeach; ?> </ul>
Don’t forget to register your custom menu!
register_nav_menus( array( 'custom-menu' => 'Custom Menu' ) );
I also wrote about how you can create
Bootstrap centred nav menus as well as Proper WordPress menus with Bootstrap 4.