Last active
          September 29, 2021 13:31 
        
      - 
      
- 
        Save annelyse/e1f0c73949f5704dc5162d2cc0b7b3e3 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <header id="header"> | |
| <div id="mainNav" class="bg-secondary"> | |
| <div class="navbar-wrapper"> | |
| <nav class="navbarMenu"> | |
| <a class="navbarMenu__brand" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a> | |
| <button class="navbarMenu__btn hamburger hamburger--spring" type="button" id="js-navbar-toggle"> | |
| <p>Menu</p> | |
| <span class="hamburger-box"> | |
| <span class="hamburger-inner"></span> | |
| </span> | |
| </button> | |
| <ul class="navbarMenu__list pull-right" id="js-menu"> | |
| <?php | |
| $menuLocations = get_nav_menu_locations(); | |
| $menuId = $menuLocations['primary']; | |
| if ($menuId != 0) : | |
| foreach (wp_get_nav_menu_items($menuId) as $menuItem) : | |
| $activeClass = ''; | |
| $ariaCurrent = ''; | |
| $currentUrl = rtrim(home_url($wp->request), '/'); | |
| $menuItemUrl = rtrim($menuItem->url, '/'); | |
| if ($menuItemUrl == $currentUrl) { | |
| $activeClass = 'active2'; | |
| $ariaCurrent = 'aria-current="page'; | |
| } | |
| ?> | |
| <li class="navbarMenu__list--item after-transform"> | |
| <a class="<?= $activeClass ?>" <?= $ariaCurrent;?> href="<?= $menuItem->url; ?>"><?= $menuItem->title; ?></a> | |
| </li> | |
| <?php endforeach; ?> | |
| <?php endif; ?> | |
| </ul> | |
| </nav> | |
| </div> | |
| </div> | |
| <div id="navResponsive"> | |
| <ul class="navResponsiveList"> | |
| <?php | |
| $menuLocations = get_nav_menu_locations(); | |
| $menuId = $menuLocations['primary']; | |
| if ($menuId != 0) : | |
| foreach (wp_get_nav_menu_items($menuId) as $menuItem) : | |
| $activeClass = ''; | |
| $currentUrl = rtrim(home_url($wp->request), '/'); | |
| $menuItemUrl = rtrim($menuItem->url, '/'); | |
| if ($menuItemUrl == $currentUrl) { | |
| $activeClass = 'active2'; | |
| $ariaCurrent = ''; | |
| } | |
| ?> | |
| <li class="navResponsiveList__item after-transform"> | |
| <a class="<?= $activeClass ?>" <?= $ariaCurrent;?> href="<?= $menuItem->url; ?>"><?= $menuItem->title; ?></a> | |
| </li> | |
| <?php endforeach; ?> | |
| <?php endif; ?> | |
| </ul> | |
| </div> | |
| </header> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment