Solution:
The next step is to create the WP_Bootstrap_Navwalker.php
and include it. Put the following line into functions.php:
file require_once(get_template_directory() . "/inc/wp-bootstrap-navwalker.php");
This assumes that the file is in an /inc
folder. If the site now runs without error, the final step is to add the 'walker' => new WP_Bootstrap_Navwalker()
line to the wp_nav_menu
call.
More info: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
Try to update your code here:
<?php
wp_nav_menu( array(
'menu' => 'primary',
'theme_location' => 'primary',
'depth' => 2,
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'bs-example-navbar-collapse-1',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback',
'walker' => new WP_Bootstrap_Navwalker()
));
?>