Bootstrap 4 menus in WordPress with filters
No walker needed!
This snippet allows you to create Bootstrap 4 menus without the use of a Walker. Instead, we're using filters to leverage WordPress core functionality as much as possible. Basically, all you need to do is this and you're done:
<nav class="navbar navbar-expand-lg fixed-top"> <div class="container"> <a class="navbar-brand" href="<?php echo home_url(); ?>">