Only add the container class if we are in the new enable_side_menu mode since it could casue issues with backwards compatiblity and css

This commit is contained in:
Enej Bajgoric 2020-12-10 11:16:29 -08:00 committed by Maggie Cabrera
parent 70c96b52de
commit 1306582c8a
3 changed files with 24 additions and 21 deletions

View file

@ -61,14 +61,15 @@ $header_classes .= $has_primary_nav ? ' has-menu' : '';
<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'varia' ); ?></span>
</label>
<?php
wp_nav_menu(
array(
'container_class' => 'main-menu-container',
'theme_location' => 'menu-1',
'menu_class' => 'main-menu',
'items_wrap' => '<ul id="%1$s" class="%2$s" aria-label="submenu">%3$s</ul>',
)
$main_nav_args = array(
'theme_location' => 'menu-1',
'menu_class' => 'main-menu',
'items_wrap' => '<ul id="%1$s" class="%2$s" aria-label="submenu">%3$s</ul>',
);
if ( get_theme_mod( 'enable_side_menu' ) === 1 ) {
$main_nav_args[ 'container_class' ] = 'main-menu-container';
}
wp_nav_menu( $main_nav_args );
?>
</nav><!-- #site-navigation -->
<?php endif; ?>

View file

@ -62,14 +62,15 @@ if ( function_exists( 'wp_body_open' ) ) {
</label>
<?php
wp_nav_menu(
array(
'container_class' => 'main-menu-container',
'theme_location' => 'menu-1',
'menu_class' => 'main-menu',
'items_wrap' => '<ul id="%1$s" class="%2$s" aria-label="submenu">%3$s</ul>',
)
$main_nav_args = array(
'theme_location' => 'menu-1',
'menu_class' => 'main-menu',
'items_wrap' => '<ul id="%1$s" class="%2$s" aria-label="submenu">%3$s</ul>',
);
if ( get_theme_mod( 'enable_side_menu' ) === 1 ) {
$main_nav_args[ 'container_class' ] = 'main-menu-container';
}
wp_nav_menu( $main_nav_args );
?>
</nav><!-- #site-navigation -->
<?php endif; ?>

View file

@ -61,14 +61,15 @@ if ( function_exists( 'wp_body_open' ) ) {
</label>
<?php
wp_nav_menu(
array(
'container_class' => 'main-menu-container',
'theme_location' => 'menu-1',
'menu_class' => 'main-menu',
'items_wrap' => '<ul id="%1$s" class="%2$s" aria-label="submenu">%3$s</ul>',
)
$main_nav_args = array(
'theme_location' => 'menu-1',
'menu_class' => 'main-menu',
'items_wrap' => '<ul id="%1$s" class="%2$s" aria-label="submenu">%3$s</ul>',
);
if ( get_theme_mod( 'enable_side_menu' ) === 1 ) {
$main_nav_args['container_class'] = 'main-menu-container';
}
wp_nav_menu( $main_nav_args );
?>
</nav><!-- #site-navigation -->
<?php endif; ?>