• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Genesis Theme Framework a2z

Genesis Theme Framework a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / Parsed Source / Parsed: 51342
function genesis_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 = [];

  if ( genesis_nav_menu_supported( 'primary' ) && has_nav_menu( 'primary' ) ) {
    $links['genesis-nav-primary'] = esc_html__( 'Skip to primary navigation', 'genesis' );
  }

  $links['genesis-content'] = esc_html__( 'Skip to main content', 'genesis' );

  if ( 'full-width-content' !== genesis_site_layout() ) {
    $links['genesis-sidebar-primary'] = esc_html__( 'Skip to primary sidebar', 'genesis' );
  }

  if ( in_array( genesis_site_layout(), [ 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'content-sidebar-sidebar' ], true ) ) {
    $links['genesis-sidebar-secondary'] = esc_html__( '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] ) && is_active_sidebar( 'footer-1' ) && ! genesis_footer_widgets_hidden_on_current_page() ) {
      $links['genesis-footer-widgets'] = esc_html__( '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 = (array) apply_filters( 'genesis_skip_links_output', $links );

  // Write HTML, skiplinks in a list.
  $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>';

  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  echo $skiplinks;

}
 

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Source ref: genesis_skip_links() – Add skip links for screen readers and keyboard navigation.
Parse count / Source file date: 1574704766
MD5 hash: 84c2c7105b052ffadbe295712c024941

Footer

Genesis a2z
Genesis Theme Framework a2z
WordPress Dynamic API Reference
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  genesis.wp-a2z.org
© Copyright Genesis a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites