Thanks for that. As you pointed out, the underscores menu is actually responsive but once you reach a certain breakpoint, instead of a hamburger, it shows a bare button (Mobile Menu) and when you click on it, it displays nav options horizontally underneath the button. So it’s all about styling then. The jquery functionality seems to be done via navigation.js that understrap loads.
At the moment the markup on the menu is:
<nav id="site-navigation" class="main-navigation">
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( 'Primary Menu', 'my-slug' ); ?></button>
<?php
wp_nav_menu( array(
'theme_location' => 'menu-1',
'menu_id' => 'primary-menu',
) );
?>
</nav><!-- #site-navigation -->
And the css:
.main-navigation {
clear: both;
display: block;
float: left;
width: 100%;
}
.main-navigation ul {
display: none;
list-style: none;
margin: 0;
padding-left: 0;
}
.main-navigation ul ul {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
float: left;
position: absolute;
top: 100%;
left: -999em;
z-index: 99999;
}
.main-navigation ul ul ul {
left: -999em;
top: 0;
}
.main-navigation ul ul li:hover>ul,
.main-navigation ul ul li.focus>ul {
left: 100%;
}
.main-navigation ul ul a {
width: 200px;
}
.main-navigation ul li:hover>ul,
.main-navigation ul li.focus>ul {
left: auto;
}
.main-navigation li {
float: left;
position: relative;
}
.main-navigation a {
display: block;
text-decoration: none;
}
/* Small menu. */
.menu-toggle,
.main-navigation.toggled ul {
display: block;
}
@media screen and (min-width: 37.5em) {
.menu-toggle {
display: none;
}
.main-navigation ul {
display: block;
}
}
.site-main .comment-navigation,
.site-main .posts-navigation,
.site-main .post-navigation {
margin: 0 0 1.5em;
overflow: hidden;
}
.comment-navigation .nav-previous,
.posts-navigation .nav-previous,
.post-navigation .nav-previous {
float: left;
width: 50%;
}
.comment-navigation .nav-next,
.posts-navigation .nav-next,
.post-navigation .nav-next {
float: right;
text-align: right;
width: 50%;
}
Is there an easy way of changing it to work with a hamburger icon? I tried your button version but it didn’t work. By the way, why do you need the span element in the button?
Thank you.