I think there is something wrong with the js of my wordpress. I'm making a custom theme and want to use bootstrap navbar in it so i found wp-bootstrap-navwalker. And i got that working on another project im working on. I copied all the code and files into the new directory. But now the mobile hamburger menu won't open. And i don't understand why because the code is pretty much identical
Here is my functions.php
<?php
require_once get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php';
register_nav_menus([ 'primary' => 'Päävalikko']);
function pagename_assets() {
wp_enqueue_style('style', get_stylesheet_uri());
wp_enqueue_style('boostrap-css', get_template_directory_uri() . '/assets/css/bootstrap.min.css', array(), '4,1,3', 'all');
wp_enqueue_script('boostrap-js', get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js', array( 'jquery' ), '4.1.3', true);
}
add_action('wp_enqueue_scripts', 'pagename_assets');
?>
Here is my header.php navbar code
<nav class="navbar navbar-expand-md navbar-light bg-light" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-controls="bs-example-navbar-collapse-1" aria-expanded="false" aria-label="<?php esc_attr_e( 'Toggle navigation', 'your-theme-slug' ); ?>">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'depth' => 1, // 1 = no dropdowns, 2 = with dropdowns.
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'bs-example-navbar-collapse-1',
'menu_class' => 'navbar-nav mr-auto',
'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback',
'walker' => new WP_Bootstrap_Navwalker(),
) );
?>
</div>
</nav>
I don't understand what is wrong because the installs of wordpress are the same version. Same bootstrap files in the same locations:
- assets
- css
- bootstrap.min.css
- js -bootstrap.bundle.min.js
- css
- inc
- class-wp-bootstrap-navwalker.php
- footer.php
- front-page.php
- functions.php
- header.php
- index.php
- style.css
It just doesn't make any sense