mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-13 07:10:00 +01:00
Bundled Themes: Add aria-current="page"
on header links.
Mark links that point to the current URL in bundled theme headers with `aria-current="page"` to inform screen reader users that this link is the current page. Changes to Twenty Ten through Twenty Twenty add `aria-current` and `rel="home"` where appropriate, Twenty Twenty One only adds `rel="home"`. Props bschneidewind, joedolson, hiabhaykulkarni, sabernhardt. Fixes #62895. Built from https://develop.svn.wordpress.org/trunk@59907 git-svn-id: http://core.svn.wordpress.org/trunk@59249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0cfe0fd2ad
commit
b2d674c7ac
@ -78,7 +78,8 @@ if ( is_singular() && get_option( 'thread_comments' ) ) {
|
||||
<div id="page" class="hfeed">
|
||||
<header id="branding">
|
||||
<hgroup>
|
||||
<h1 id="site-title"><span><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1>
|
||||
<?php $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); ?>
|
||||
<h1 id="site-title"><span><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></span></h1>
|
||||
<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
|
||||
</hgroup>
|
||||
|
||||
@ -97,7 +98,7 @@ if ( is_singular() && get_option( 'thread_comments' ) ) {
|
||||
$header_image_width = HEADER_IMAGE_WIDTH;
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>>
|
||||
<?php
|
||||
/*
|
||||
* The header image.
|
||||
|
@ -33,12 +33,12 @@
|
||||
<div class="site-branding">
|
||||
<?php
|
||||
twentyfifteen_the_custom_logo();
|
||||
|
||||
$is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) );
|
||||
if ( is_front_page() && is_home() ) :
|
||||
?>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php else : ?>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></p>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
|
@ -33,9 +33,10 @@
|
||||
<body <?php body_class(); ?>>
|
||||
<?php wp_body_open(); ?>
|
||||
<div id="page" class="hfeed site">
|
||||
<?php $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); ?>
|
||||
<?php if ( get_header_image() ) : ?>
|
||||
<div id="site-header">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>>
|
||||
<?php twentyfourteen_header_image(); ?>
|
||||
</a>
|
||||
</div>
|
||||
@ -43,7 +44,7 @@
|
||||
|
||||
<header id="masthead" class="site-header">
|
||||
<div class="header-main">
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||
|
||||
<div class="search-toggle">
|
||||
<a href="#search-container" class="screen-reader-text" aria-expanded="false" aria-controls="search-container">
|
||||
|
@ -13,11 +13,12 @@
|
||||
<div class="site-logo"><?php the_custom_logo(); ?></div>
|
||||
<?php endif; ?>
|
||||
<?php $blog_info = get_bloginfo( 'name' ); ?>
|
||||
<?php $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); ?>
|
||||
<?php if ( ! empty( $blog_info ) ) : ?>
|
||||
<?php if ( is_front_page() && is_home() ) : ?>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php else : ?>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
@ -15,10 +15,11 @@
|
||||
<?php the_custom_logo(); ?>
|
||||
|
||||
<div class="site-branding-text">
|
||||
<?php $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); ?>
|
||||
<?php if ( is_front_page() ) : ?>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php else : ?>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
|
@ -36,11 +36,11 @@
|
||||
<div class="site-header-main">
|
||||
<div class="site-branding">
|
||||
<?php twentysixteen_the_custom_logo(); ?>
|
||||
|
||||
<?php $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); ?>
|
||||
<?php if ( is_front_page() && is_home() ) : ?>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php else : ?>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></p>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
@ -101,7 +101,7 @@
|
||||
$custom_header_sizes = apply_filters( 'twentysixteen_custom_header_sizes', '(max-width: 709px) 85vw, (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px' );
|
||||
?>
|
||||
<div class="header-image">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>>
|
||||
<?php
|
||||
$custom_header = get_custom_header();
|
||||
$attrs = array(
|
||||
|
@ -71,7 +71,8 @@ if ( is_singular() && get_option( 'thread_comments' ) ) {
|
||||
<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
|
||||
<<?php echo $heading_tag; ?> id="site-title">
|
||||
<span>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
|
||||
<?php $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); ?>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a>
|
||||
</span>
|
||||
</<?php echo $heading_tag; ?>>
|
||||
<div id="site-description"><?php bloginfo( 'description' ); ?></div>
|
||||
|
@ -23,7 +23,8 @@
|
||||
<?php wp_body_open(); ?>
|
||||
<div id="page" class="hfeed site">
|
||||
<header id="masthead" class="site-header">
|
||||
<a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
|
||||
<?php $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); ?>
|
||||
<a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>>
|
||||
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
|
||||
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
|
||||
</a>
|
||||
|
@ -36,7 +36,8 @@
|
||||
<div id="page" class="hfeed site">
|
||||
<header id="masthead" class="site-header">
|
||||
<hgroup>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); ?>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
|
||||
</hgroup>
|
||||
|
||||
@ -54,7 +55,7 @@
|
||||
</nav><!-- #site-navigation -->
|
||||
|
||||
<?php if ( get_header_image() ) : ?>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php twentytwelve_header_image(); ?></a>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" <?php echo $is_front ? 'aria-current="page"' : ''; ?> rel="home"><?php twentytwelve_header_image(); ?></a>
|
||||
<?php endif; ?>
|
||||
</header><!-- #masthead -->
|
||||
|
||||
|
@ -40,7 +40,7 @@ function twentytwenty_site_logo( $args = array(), $display = true ) {
|
||||
$defaults = array(
|
||||
'logo' => '%1$s<span class="screen-reader-text">%2$s</span>',
|
||||
'logo_class' => 'site-logo',
|
||||
'title' => '<a href="%1$s">%2$s</a>',
|
||||
'title' => '<a href="%1$s" rel="home">%2$s</a>',
|
||||
'title_class' => 'site-title',
|
||||
'home_wrap' => '<h1 class="%1$s">%2$s</h1>',
|
||||
'single_wrap' => '<div class="%1$s faux-heading">%2$s</div>',
|
||||
@ -63,7 +63,14 @@ function twentytwenty_site_logo( $args = array(), $display = true ) {
|
||||
$contents = sprintf( $args['logo'], $logo, esc_html( $site_title ) );
|
||||
$classname = $args['logo_class'];
|
||||
} else {
|
||||
$contents = sprintf( $args['title'], esc_url( get_home_url( null, '/' ) ), esc_html( $site_title ) );
|
||||
$contents = sprintf( $args['title'], esc_url( get_home_url( null, '/' ) ), esc_html( $site_title ) );
|
||||
if (
|
||||
( is_front_page() || is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) )
|
||||
&& ! is_paged()
|
||||
&& $args['title'] === $defaults['title']
|
||||
) {
|
||||
$contents = str_replace( ' rel=', ' aria-current="page" rel=', $contents );
|
||||
}
|
||||
$classname = $args['title_class'];
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ $header_class = $show_title ? 'site-title' : 'screen-reader-text';
|
||||
<?php if ( is_front_page() && ! is_paged() ) : ?>
|
||||
<h1 class="<?php echo esc_attr( $header_class ); ?>"><?php echo esc_html( $blog_info ); ?></h1>
|
||||
<?php elseif ( is_front_page() && ! is_home() ) : ?>
|
||||
<h1 class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></h1>
|
||||
<h1 class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo esc_html( $blog_info ); ?></a></h1>
|
||||
<?php else : ?>
|
||||
<p class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></p>
|
||||
<p class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo esc_html( $blog_info ); ?></a></p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
*
|
||||
* @since 6.8.0
|
||||
*
|
||||
* @global WP_Query $wp_query WordPress Query object.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-alpha-59906';
|
||||
$wp_version = '6.8-alpha-59907';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user