Making WordPress.org

Changeset 11448


Ignore:
Timestamp:
01/17/2022 04:45:59 AM (4 years ago)
Author:
dd32
Message:

Themes: Use a mu-plugin to output consistent skip-to links for all themes.

This is to remove the reliance upon $wporg_global_header_options.

See https://github.com/WordPress/wporg-mu-plugins/issues/42, https://github.com/WordPress/wporg-mu-plugins/pull/70.
Closes https://github.com/WordPress/wordpress.org/pull/49

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/header.php

    r11431 r11448  
    99 * @package Gutenbergtheme
    1010 */
     11
     12\WordPressdotorg\skip_to( '#content' );
     13
    1114require WPORGPATH . 'header.php';
    1215?>
    1316
    1417<div id="page" class="site">
    15     <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'gutenbergtheme' ); ?></a>
    1618        <header id="masthead" class="site-header">
    1719            <div class="site-branding">
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/header.php

    r11431 r11448  
    11<?php
     2
     3\WordPressdotorg\skip_to( '#content' );
    24
    35if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
    46    echo do_blocks( '<!-- wp:wporg/global-header /-->' );
    57} else {
    6     global $wporg_global_header_options;
    7     if ( !isset( $wporg_global_header_options['in_wrapper'] ) )
    8         $wporg_global_header_options['in_wrapper'] = '';
    9     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#content">' . esc_html__( 'Skip to content', 'wporg' ) . '</a>';
    108    require WPORGPATH . 'header.php';
    119}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/header.php

    r11413 r11448  
    1414use function WPOrg_Learn\Locale\{ locale_notice };
    1515
     16\WordPressdotorg\skip_to( '#main' );
     17
    1618if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
    1719    // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    1820    echo do_blocks( '<!-- wp:wporg/global-header /-->' );
    1921} else {
    20     global $wporg_global_header_options;
    21     if ( ! isset( $wporg_global_header_options['in_wrapper'] ) ) {
    22         $wporg_global_header_options['in_wrapper'] = '';
    23     }
    24     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#content">' . esc_html__( 'Skip to content', 'wporg-learn' ) . '</a>';
    2522    wporg_get_global_header();
    2623}
     
    3734
    3835<div id="page" class="site">
    39     <a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content', 'wporg-learn' ); ?></a>
    40 
    4136    <div id="content">
    4237        <header id="masthead" class="site-header <?php echo is_front_page() ? 'home' : ''; ?>" role="banner">
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn/header.php

    r6293 r11448  
    1010 */
    1111
     12\WordPressdotorg\skip_to( '#main' );
     13
    1214get_header( 'wporg' );
    1315?>
    1416<div id="page" class="site">
    15     <a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content', 'wporg' ); ?></a>
    16 
    1717    <div id="content" class="site-content">
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/front-page.php

    r11420 r11448  
    3535$user_class = $showcase ? 'col-12' : 'col-2';
    3636
    37 // Temporarily add a Skip-to-content selector for front pages.
    38 if ( ! isset( $wporg_global_header_options['in_wrapper'] ) ) {
    39     $wporg_global_header_options['in_wrapper'] = '<a class="skip-link screen-reader-text" href="#masthead">' . __( 'Skip to content', 'wporg' ) . '</a>';
    40 }
     37\WordPressdotorg\skip_to( '#masthead' );
    4138
    4239get_header( 'wporg' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/functions.php

    r11428 r11448  
    3838     */
    3939    add_theme_support( 'post-thumbnails' );
     40
     41    /*
     42     * Enable WordPress.org skip-to links.
     43     */
     44    add_action( 'wp_head', '\WordPressdotorg\skip_to_main' );
    4045}
    4146add_action( 'after_setup_theme', __NAMESPACE__ . '\setup' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/header-child-page.php

    r7367 r11448  
    1717?>
    1818<div id="page" class="site">
    19     <a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content', 'wporg' ); ?></a>
    20 
    2119    <div id="content" class="site-content row gutters">
    2220        <header id="masthead" class="site-header col-12" role="banner">
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/header-top-level-page.php

    r11404 r11448  
    3030
    3131<div id="page" class="site">
    32     <a class="skip-link screen-reader-text" href="#main">
    33         <?php esc_html_e( 'Skip to content', 'wporg' ); ?>
    34     </a>
    35 
    3632    <div id="content" class="site-content row gutters">
    3733        <header id="masthead" class="site-header home col-12" role="banner">
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-makehome/header.php

    r11431 r11448  
    11<?php
     2
     3\WordPressdotorg\skip_to( '#headline' );
    24
    35if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
    46    echo do_blocks( '<!-- wp:wporg/global-header /-->' );
    57} else {
    6     global $wporg_global_header_options;
    7     if ( !isset( $wporg_global_header_options['in_wrapper'] ) ) {
    8         $wporg_global_header_options['in_wrapper'] = '';
    9     }
    10     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#headline">' . esc_html( 'Skip to content', 'make-wporg' ) . '</a>';
    118    require( WPORGPATH . 'header.php' );
    129}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/header.php

    r11431 r11448  
    1212namespace WordPressdotorg\Openverse\Theme;
    1313
     14\WordPressdotorg\skip_to( '#content' );
     15
    1416if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
    1517    echo do_blocks( '<!-- wp:wporg/global-header /-->' );
    1618} else {
    17     global $wporg_global_header_options;
    18     if ( ! isset( $wporg_global_header_options['in_wrapper'] ) ) {
    19         $wporg_global_header_options['in_wrapper'] = '';
    20     }
    21     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#content">' . esc_html__( 'Skip to content', 'wporg' ) . '</a>';
    22 
    2319    get_template_part( 'header', 'wporg' );
    2420}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/header.php

    r11431 r11448  
    1414use const WordPressdotorg\Pattern_Directory\Pattern_Post_Type\POST_TYPE;
    1515
    16 global $wporg_global_header_options;
    17 if ( ! isset( $wporg_global_header_options['in_wrapper'] ) ) {
    18     $wporg_global_header_options['in_wrapper'] = '';
    19 }
    20 $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#content">' . esc_html__( 'Skip to content', 'wporg-patterns' ) . '</a>';
     16\WordPressdotorg\skip_to( '#content' );
    2117
    2218get_template_part( 'header', 'wporg' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/header.php

    r11431 r11448  
    1212namespace WordPressdotorg\Plugin_Directory\Theme;
    1313
     14\WordPressdotorg\skip_to( '#main' );
     15
    1416$menu_items = array(
    1517    '/browse/favorites/' => __( 'My Favorites', 'wporg-plugins' ),
     
    2123    echo do_blocks( '<!-- wp:wporg/global-header /-->' );
    2224} else {
    23     global $wporg_global_header_options;
    24     if ( !isset( $wporg_global_header_options['in_wrapper'] ) )
    25         $wporg_global_header_options['in_wrapper'] = '';
    26     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#main">' . esc_html__( 'Skip to content', 'wporg-plugins' ) . '</a>';
    2725    require WPORGPATH . 'header.php';
    2826}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-showcase/header.php

    r11431 r11448  
    11<?php
     2
     3\WordPressdotorg\skip_to( '#pagebody' );
    24
    35if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
    46    echo do_blocks( '<!-- wp:wporg/global-header /-->' );
    57} else {
    6     global $wporg_global_header_options;
    7     if ( !isset( $wporg_global_header_options['in_wrapper'] ) )
    8         $wporg_global_header_options['in_wrapper'] = '';
    9     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#pagebody">' . esc_html__( 'Skip to content', 'wporg-showcase' ) . '</a>';
    108    require WPORGPATH . 'header.php';
    119}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/header.php

    r11402 r11448  
    2020);
    2121
     22\WordPressdotorg\skip_to( '#content' );
     23
    2224if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
    2325    echo do_blocks( '<!-- wp:wporg/global-header /-->' );
    2426} else {
    25     global $wporg_global_header_options;
    26     if ( !isset( $wporg_global_header_options['in_wrapper'] ) )
    27         $wporg_global_header_options['in_wrapper'] = '';
    28     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#content">' . esc_html__( 'Skip to content', 'wporg-forums' ) . '</a>';
    2927    wporg_get_global_header();
    3028}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/header.php

    r11431 r11448  
    66 */
    77
     8\WordPressdotorg\skip_to( '#themes' );
     9
    810if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
    911    echo do_blocks( '<!-- wp:wporg/global-header /-->' );
    1012} else {
    11     global $wporg_global_header_options;
    12     if ( !isset( $wporg_global_header_options['in_wrapper'] ) )
    13         $wporg_global_header_options['in_wrapper'] = '';
    14     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#themes">' . esc_html__( 'Skip to content', 'wporg-themes' ) . '</a>';
    1513    require WPORGPATH . 'header.php';
    1614}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/header-page.php

    r6657 r11448  
    1212namespace WordPressdotorg\Theme;
    1313
     14\WordPressdotorg\skip_to( '#main' );
     15
    1416get_template_part( 'header', 'wporg' );
    1517?>
    1618<div id="page" class="site">
    17     <a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content', 'wporg' ); ?></a>
    18 
    1919    <div id="content" class="site-content row gutters">
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/header.php

    r11388 r11448  
    1212namespace WordPressdotorg\Theme;
    1313
    14 if ( ! FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
    15     global $wporg_global_header_options;
    16 
    17     if ( ! isset( $wporg_global_header_options['in_wrapper'] ) ) {
    18         $wporg_global_header_options['in_wrapper'] = '';
    19     }
    20     $wporg_global_header_options['in_wrapper'] .= '<a class="skip-link screen-reader-text" href="#content">' . esc_html__( 'Skip to content', 'wporg' ) . '</a>';
    21 }
     14\WordPressdotorg\skip_to( '#content' );
    2215
    2316get_template_part( 'header', 'wporg' );
Note: See TracChangeset for help on using the changeset viewer.