This repository has been archived on 2024-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
qdouze2-wordpress-theme/components/mobile-sidebar.php

53 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2023-05-02 11:20:14 +02:00
<nav id="mobile-sidebar" class="bg-dark fg-light sidebar menu hidden">
2023-05-03 11:27:05 +02:00
<h1 class="align-center text-light">Menu du site</h1>
2023-05-02 11:20:14 +02:00
<div class="mb-1">
2023-11-24 20:23:34 +01:00
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div>
<label for="searchfield2" class="sr-only">Formulaire de recherche</label>
<input class="form-control" id="searchfield2" type="search" placeholder="Chercher sur le site" aria-label="Chercher sur le site" value="<?php the_search_query(); ?>" name="s" id="s" />
</div>
</form>
2023-05-02 11:20:14 +02:00
</div>
2023-11-24 20:23:34 +01:00
<h2 id="sidebar-menu-principal-titre">Menu principal</h2>
<ul aria-labelledby="sidebar-menu-principal-titre">
2023-05-02 11:20:14 +02:00
<li>
<a href="<?php echo site_url(); ?>" class="menu-item">
2023-11-20 13:04:09 +01:00
<span><svg class="icon icon-home" alt=""><use xlink:href="#icon-home"></use></svg> Accueil</span>
2023-05-02 11:20:14 +02:00
</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>
2023-11-24 20:23:34 +01:00
<h2 id="sidebar-categories-titre">Liste des catégories</h2>
<ul aria-labelledby="sidebar-categories-titre">
2023-05-02 11:20:14 +02:00
<?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>
2023-11-24 20:23:34 +01:00
<h2 id="sidebar-pages-titre">Pages</h2>
<ul aria-labelledby="sidebar-pages-titre">
2023-05-03 11:27:05 +02:00
<?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>
2023-05-02 11:20:14 +02:00
</nav>
2023-11-20 13:04:09 +01:00
<button id="mobile-button" class="menu-button"><svg class="icon icon-bars" alt=""><use xlink:href="#icon-bars"></use></svg> <span class="sr-only">Afficher le menu</span></button>