Last active
August 26, 2016 19:54
-
-
Save stephanieleary/2d97980fc4fdea3eec5222b5aa38ab0a to your computer and use it in GitHub Desktop.
Better Genesis a11y
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
<?php | |
// Replace primary navigation to remove unnecessary "Main navigation" heading, duplicated in ARIA label | |
remove_action( 'genesis_after_header', 'genesis_do_nav' ); | |
add_action( 'genesis_after_header', 'scl_do_nav' ); | |
function scl_do_nav() { | |
//* Do nothing if menu not supported | |
if ( ! genesis_nav_menu_supported( 'primary' ) || ! has_nav_menu( 'primary' ) ) | |
return; | |
$class = 'menu genesis-nav-menu menu-primary'; | |
if ( genesis_superfish_enabled() ) { | |
$class .= ' js-superfish'; | |
} | |
genesis_nav_menu( array( | |
'theme_location' => 'primary', | |
'menu_class' => $class, | |
) ); | |
} | |
// Filter Skip link text to ensure "CONtent" pronunciation | |
// ("skip to content" is pronounced conTENT in most screen readers) | |
// cf. webaim.org/techniques/screenreader/#how | |
add_filter( 'genesis_skip_links_output', 'scl_skip_links_output' ); | |
function scl_skip_links_output( $links ) { | |
$links['genesis-content'] = esc_html__( 'Skip to main content' ); | |
return $links; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment