<nav id="mobile-sidebar" class="bg-dark fg-light sidebar menu hidden">
  <h1 class="align-center text-light">Menu du site</h1>
  <div class="mb-1">
    <?php include(TEMPLATEPATH . '/components/searchform.php'); ?>
  </div>
  <ul>
    <h2>Menu principal</h2>
    <li>
      <a href="<?php echo site_url(); ?>" class="menu-item">
        <span><i class="fa fa-home"  aria-hidden="true"></i> Accueil</span>
      </a>
    </li>
    <?php
      $listmenu = get_nav_menu_locations();
      $menu = wp_get_nav_menu_items($listmenu['top-navbar']);
        foreach ($menu as $menuElement) {
          echo '<li><a href="' . $menuElement->url . '" class="menu-item">'. $menuElement->title . '</a></li>';
        }
      ?>
  </ul>
  <ul>
    <h2>Liste des catégories</h2>
    <?php
      $categories = get_categories( array(
        'orderby' => 'name',
        'order'   => 'ASC'
      ) );

      foreach( $categories as $category ) {?>
        <li>
          <a class="menu-item" href="<?php echo get_category_link($category->term_id) ?>"><?php echo $category->name ?></a>
        </li>
      <?php }
    ?>
  </ul>
  <ul>
    <h2>Pages</h2>
    <?php
      $listmenu = get_nav_menu_locations();
      $menu = wp_get_nav_menu_items($listmenu['top-navbar-2']);
        foreach ($menu as $menuElement) {
          echo '<li><a href="' . $menuElement->url . '" class="menu-item">'. $menuElement->title . '</a></li>';
        }
      ?>
  </ul>
</nav>

<button id="mobile-button" class="menu-button"><i class="fa fa-navicon" aria-hidden="true"></i> <span class="sr-only">Afficher le menu</span></button>