Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- remove_action ( 'genesis_before_header', 'genesis_skip_links', 5 );
- add_action ( 'genesis_before_header', 'sk_skip_links', 5 );
- /**
- * Add skiplinks for screen readers and keyboard navigation
- *
- * @since 2.2.0
- */
- function sk_skip_links() {
- if ( ! genesis_a11y( 'skip-links' ) ) {
- return;
- }
- // Call function to add IDs to the markup
- genesis_skiplinks_markup();
- // Determine which skip links are needed
- $links = array();
- if ( genesis_nav_menu_supported( 'primary' ) && has_nav_menu( 'primary' ) ) {
- $links['genesis-nav-primary'] = __( 'Skip to primary navigation', 'genesis' );
- }
- $links['genesis-content'] = __( 'Skip to content', 'genesis' );
- if ( 'full-width-content' != genesis_site_layout() ) {
- $links['genesis-sidebar-primary'] = __( 'Skip to primary sidebar', 'genesis' );
- }
- if ( in_array( genesis_site_layout(), array( 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'content-sidebar-sidebar' ) ) ) {
- $links['genesis-sidebar-secondary'] = __( 'Skip to secondary sidebar', 'genesis' );
- }
- if ( current_theme_supports( 'genesis-footer-widgets' ) ) {
- $footer_widgets = get_theme_support( 'genesis-footer-widgets' );
- if ( isset( $footer_widgets[0] ) && is_numeric( $footer_widgets[0] ) ) {
- if ( is_active_sidebar( 'footer-1' ) ) {
- $links['genesis-footer-widgets'] = __( 'Skip to footer', 'genesis' );
- }
- }
- }
- /**
- * Filter the skip links.
- *
- * @since 2.2.0
- *
- * @param array $links {
- * Default skiplinks.
- *
- * @type string HTML ID attribute value to link to.
- * @type string Anchor text.
- * }
- */
- $links = apply_filters( 'genesis_skip_links_output', $links );
- // write HTML, skiplinks in a list with a heading
- $skiplinks = '<section>';
- $skiplinks .= '<h3 class="screen-reader-text">'. __( 'Skip links', 'genesis' ) .'</h3>';
- $skiplinks .= '<ul class="genesis-skip-link">';
- // Add markup for each skiplink
- foreach ($links as $key => $value) {
- $skiplinks .= '<li><a href="' . esc_url( '#' . $key ) . '" class="screen-reader-shortcut"> ' . $value . '</a></li>';
- }
- $skiplinks .= '</ul>';
- $skiplinks .= '</section>' . "\n";
- echo $skiplinks;
- }
Advertisement
Add Comment
Please, Sign In to add comment