Skip to content

Instantly share code, notes, and snippets.

@SteveJonesDev
SteveJonesDev / accessible-menu.php
Last active July 24, 2025 20:11
Accessible WordPress Navigation Menu
<div class="menu-container">
<button class="menu-button" aria-expanded="false" aria-controls="site-header-menu" aria-label="<?php esc_attr_e( 'Menu', 'textdomain' ); ?>"></button>
<div id="site-header-menu" class="site-header-menu">
<?php
wp_nav_menu(
array(
'theme_location' => 'primary',
'container' => 'nav',
'container_class' => 'main-navigation',
'container_id' => 'site-navigation',
@SteveJonesDev
SteveJonesDev / accessible-popup-modal.php
Last active August 25, 2025 14:54
Accessible Popup Modal for WordPress
/**
* Adds an accessible popup to the footer.
*
* This function outputs the HTML, CSS, and JavaScript needed for an accessible popup.
* The popup can be opened with a button click, and it traps focus within itself when open.
* The popup can be closed with a button click or by pressing the Escape key.
*/
function add_accessible_popup_to_footer() {
?>
<!-- Accessible Popup HTML -->