Soil 4 NavWalker - What to use for the "walker" value in wp_nav_menu

Hey all,

Does anyone have an example of how to set the Navwalker up using the wp_nav_menu() function and soil 4. I just downloaded the plugin (yes I paid) but I can’t get into the dashboard for support.

below was my legacy code I was using for a previous project with wp_boostrap4_navwalker

   wp_nav_menu( array(
     'menu'            => 'Main Menu',
     'theme_location'  => 'primary_navigation',
     'depth'	          => 2, // 1 = no dropdowns, 2 = with dropdowns.
     'container'       => 'div',
     'container_class' => 'ms-auto d-inline-flex',
     'container_id'    => 'bs-example-navbar-collapse-1',
     'menu_class'      => 'navbar-nav',
     //'fallback_cb'     => 'WP_Bootstrap_Navwalker::fallback',
     //'walker'          => new wp_bootstrap4_navwalker(),
       )
     );

I’m trying to figure out what goes here:

     //'fallback_cb'     => 'WP_Bootstrap_Navwalker::fallback',
     //'walker'          => new wp_bootstrap4_navwalker(),

The documentation seems limited. Anyone have a code snippet they can share for best practice?

Thanks in advance.

Hi there!

If you’re wanting to use Soil’s nav walker and have enabled the feature/module, then you need to omit the walker argument entirely from your wp_nav_menu() call. At this point, Soil will use the “clean” nav walker.

Thanks, appreciate the explanation. I currently have it enabled and the the walker argument is commented out so it must be working properly.

1 Like