Skip to content

Instantly share code, notes, and snippets.

@jmccall75
jmccall75 / accessible-menu.php
Created February 14, 2023 13:19 — forked from SteveJonesDev/accessible-menu.php
Accessible WordPress Navigation Menu
<div class="menu-container">
<button class="menu-button" aria-controls="site-header-menu"><span class="screen-reader-text"><?php esc_html_e('Menu','rwc'); ?></span></button>
<div id="site-header-menu" class="site-header-menu">
<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e('Primary Menu', 'rwc'); ?>">
<?php
wp_nav_menu(array(
'theme_location' => 'primary',
'depth' => 3,
'menu_id' => 'primary-menu',
'container_class' => 'nav-primary'