Skip to content

Instantly share code, notes, and snippets.

@sillybean
Last active Aug 26, 2016
Embed
What would you like to do?
Better Genesis a11y
<?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