Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Commit

Permalink
Remove unnecessary HTML output (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinan authored and andersnoren committed Oct 12, 2019
1 parent c34a860 commit afec726
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,38 +121,31 @@
<?php
}

$header_toggles_classes = '';

if ( ! has_nav_menu( 'expanded' ) && false === $enable_header_search ) {
$header_toggles_classes .= ' hide-on-desktop';
}
?>
if ( true === $enable_header_search || has_nav_menu( 'expanded' ) ) {
?>

<div class="header-toggles hide-no-js<?php echo $header_toggles_classes; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>">
<div class="header-toggles hide-no-js">

<?php
$nav_toggle_wrapper_classes = '';

// Add a class indicating whether the navigation toggle wrapper can be hidden on desktop.
if ( has_nav_menu( 'expanded' ) ) {
$nav_toggle_wrapper_classes .= ' has-expanded-menu';
}
?>
?>

<div class="toggle-wrapper nav-toggle-wrapper<?php echo $nav_toggle_wrapper_classes; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>">
<div class="toggle-wrapper nav-toggle-wrapper has-expanded-menu">

<button class="toggle nav-toggle desktop-nav-toggle" data-toggle-target=".menu-modal" data-toggle-body-class="showing-menu-modal" aria-expanded="false" data-set-focus=".close-nav-toggle">
<span class="toggle-inner">
<span class="toggle-text"><?php _e( 'Menu', 'twentytwenty' ); ?></span>
<span class="toggle-icon">
<?php twentytwenty_the_theme_svg( 'ellipsis' ); ?>
<button class="toggle nav-toggle desktop-nav-toggle" data-toggle-target=".menu-modal" data-toggle-body-class="showing-menu-modal" aria-expanded="false" data-set-focus=".close-nav-toggle">
<span class="toggle-inner">
<span class="toggle-text"><?php _e( 'Menu', 'twentytwenty' ); ?></span>
<span class="toggle-icon">
<?php twentytwenty_the_theme_svg( 'ellipsis' ); ?>
</span>
</span>
</span>
</button><!-- .nav-toggle -->
</button><!-- .nav-toggle -->

</div><!-- .nav-toggle-wrapper -->
</div><!-- .nav-toggle-wrapper -->

<?php
}

<?php
if ( true === $enable_header_search ) {
?>

Expand All @@ -171,7 +164,10 @@
}
?>

</div><!-- .header-toggles -->
</div><!-- .header-toggles -->
<?php
}
?>

</div><!-- .header-navigation-wrapper -->

Expand Down

0 comments on commit afec726

Please sign in to comment.