Twenty Fourteen: remove title attributes for better accessibility. Props sabreuse for original patch, see #25054.

Built from https://develop.svn.wordpress.org/trunk@25743


git-svn-id: http://core.svn.wordpress.org/trunk@25656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-10-09 19:07:09 +00:00
parent ffd47afa4b
commit 66be5edfb5
14 changed files with 20 additions and 26 deletions

View File

@ -27,9 +27,8 @@ get_header(); ?>
the_post(); the_post();
printf( __( 'All posts by %s', 'twentyfourteen' ), sprintf( printf( __( 'All posts by %s', 'twentyfourteen' ), sprintf(
'<span class="vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="me">%3$s</a></span>', '<span class="vcard"><a class="url fn n" href="%1$s" rel="me">%2$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( get_the_author() ),
get_the_author() get_the_author()
) ); ) );
?> ?>

View File

@ -19,7 +19,7 @@
<div class="entry-meta"> <div class="entry-meta">
<span class="post-format"> <span class="post-format">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'aside' ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( 'aside' ) ) ); ?>"><?php echo get_post_format_string( 'aside' ); ?></a> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'aside' ) ); ?>"><?php echo get_post_format_string( 'aside' ); ?></a>
</span> </span>
<?php twentyfourteen_posted_on(); ?> <?php twentyfourteen_posted_on(); ?>

View File

@ -6,7 +6,7 @@
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a class="attachment-featured-featured" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyfourteen' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="<?php the_ID(); ?>"> <a class="attachment-featured-featured" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
<?php <?php
if ( has_post_thumbnail() ) : if ( has_post_thumbnail() ) :
the_post_thumbnail( 'featured-thumbnail-featured' ); the_post_thumbnail( 'featured-thumbnail-featured' );

View File

@ -29,7 +29,7 @@ endif;
<?php echo wp_get_attachment_image( $image, 'featured-thumbnail-large' ); ?> <?php echo wp_get_attachment_image( $image, 'featured-thumbnail-large' ); ?>
</div> </div>
<?php elseif ( $image ) : ?> <?php elseif ( $image ) : ?>
<a class="attachment-featured-thumbnail" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyfourteen' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="<?php the_ID(); ?>"> <a class="attachment-featured-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
<?php echo wp_get_attachment_image( $image, 'featured-thumbnail-large' ); ?> <?php echo wp_get_attachment_image( $image, 'featured-thumbnail-large' ); ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
@ -51,7 +51,7 @@ endif;
<div class="entry-meta"> <div class="entry-meta">
<span class="post-format"> <span class="post-format">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'gallery' ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( 'gallery' ) ) ); ?>"><?php echo get_post_format_string( 'gallery' ); ?></a> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'gallery' ) ); ?>"><?php echo get_post_format_string( 'gallery' ); ?></a>
</span> </span>
<?php twentyfourteen_posted_on(); ?> <?php twentyfourteen_posted_on(); ?>

View File

@ -27,7 +27,7 @@
<div class="entry-meta"> <div class="entry-meta">
<span class="post-format"> <span class="post-format">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'image' ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( 'image' ) ) ); ?>"><?php echo get_post_format_string( 'image' ); ?></a> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'image' ) ); ?>"><?php echo get_post_format_string( 'image' ); ?></a>
</span> </span>
<?php twentyfourteen_posted_on(); ?> <?php twentyfourteen_posted_on(); ?>

View File

@ -19,7 +19,7 @@
<div class="entry-meta"> <div class="entry-meta">
<span class="post-format"> <span class="post-format">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'link' ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( 'link' ) ) ); ?>"><?php echo get_post_format_string( 'link' ); ?></a> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'link' ) ); ?>"><?php echo get_post_format_string( 'link' ); ?></a>
</span> </span>
<?php twentyfourteen_posted_on(); ?> <?php twentyfourteen_posted_on(); ?>

View File

@ -19,7 +19,7 @@
<div class="entry-meta"> <div class="entry-meta">
<span class="post-format"> <span class="post-format">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'quote' ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( 'quote' ) ) ); ?>"><?php echo get_post_format_string( 'quote' ); ?></a> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'quote' ) ); ?>"><?php echo get_post_format_string( 'quote' ); ?></a>
</span> </span>
<?php twentyfourteen_posted_on(); ?> <?php twentyfourteen_posted_on(); ?>

View File

@ -27,7 +27,7 @@
<div class="entry-meta"> <div class="entry-meta">
<span class="post-format"> <span class="post-format">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'video' ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( 'video' ) ) ); ?>"><?php echo get_post_format_string( 'video' ); ?></a> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'video' ) ); ?>"><?php echo get_post_format_string( 'video' ); ?></a>
</span> </span>
<?php twentyfourteen_posted_on(); ?> <?php twentyfourteen_posted_on(); ?>

View File

@ -18,7 +18,7 @@
<div class="site-info"> <div class="site-info">
<?php do_action( 'twentyfourteen_credits' ); ?> <?php do_action( 'twentyfourteen_credits' ); ?>
<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyfourteen' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyfourteen' ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentyfourteen' ), 'WordPress' ); ?></a> <a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyfourteen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentyfourteen' ), 'WordPress' ); ?></a>
</div><!-- .site-info --> </div><!-- .site-info -->
</footer><!-- #colophon --> </footer><!-- #colophon -->
</div><!-- #page --> </div><!-- #page -->

View File

@ -332,9 +332,8 @@ function twentyfourteen_the_attached_image() {
$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) ); $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
} }
printf( '<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>', printf( '<a href="%1$s" rel="attachment">%2$s</a>',
esc_url( $next_attachment_url ), esc_url( $next_attachment_url ),
the_title_attribute( array( 'echo' => false ) ),
wp_get_attachment_image( $post->ID, $attachment_size ) wp_get_attachment_image( $post->ID, $attachment_size )
); );
} }

View File

@ -28,7 +28,7 @@
<?php if ( get_header_image() ) : ?> <?php if ( get_header_image() ) : ?>
<div id="site-header"> <div id="site-header">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"> <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /> <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
</a> </a>
</div> </div>
@ -36,7 +36,7 @@
<header id="masthead" class="site-header" role="banner"> <header id="masthead" class="site-header" role="banner">
<div class="header-main"> <div class="header-main">
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<div class="header-extra"> <div class="header-extra">
<div class="search-toggle"> <div class="search-toggle">

View File

@ -24,9 +24,9 @@ get_header();
<span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time></span> <span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time></span>
<span class="full-size-link"><a href="<?php echo wp_get_attachment_url(); ?>" title="Link to full-size image"><?php echo $metadata['width']; ?> &times; <?php echo $metadata['height']; ?></a></span> <span class="full-size-link"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $metadata['width']; ?> &times; <?php echo $metadata['height']; ?></a></span>
<span class="parent-post-link"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="Return to <?php echo esc_attr( get_the_title( $post->post_parent ) ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a></span> <span class="parent-post-link"><a href="<?php echo get_permalink( $post->post_parent ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a></span>
<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?> <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-meta --> </div><!-- .entry-meta -->
</header><!-- .entry-header --> </header><!-- .entry-header -->
@ -58,11 +58,11 @@ get_header();
<footer class="entry-meta"> <footer class="entry-meta">
<?php <?php
if ( comments_open() && pings_open() ) : // Comments and trackbacks open if ( comments_open() && pings_open() ) : // Comments and trackbacks open
printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyfourteen' ), get_trackback_url() ); printf( __( '<a class="comment-link" href="#respond">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" rel="trackback">Trackback URL</a>.', 'twentyfourteen' ), get_trackback_url() );
elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open
printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyfourteen' ), get_trackback_url() ); printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" rel="trackback">Trackback URL</a>.', 'twentyfourteen' ), get_trackback_url() );
elseif ( comments_open() && ! pings_open() ) : // Only comments open elseif ( comments_open() && ! pings_open() ) : // Only comments open
_e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'twentyfourteen' ); _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond">post a comment</a>.', 'twentyfourteen' );
elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed
_e( 'Both comments and trackbacks are currently closed.', 'twentyfourteen' ); _e( 'Both comments and trackbacks are currently closed.', 'twentyfourteen' );
endif; endif;

View File

@ -94,13 +94,11 @@ function twentyfourteen_posted_on() {
if ( is_sticky() && is_home() && ! is_paged() ) if ( is_sticky() && is_home() && ! is_paged() )
echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>'; echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>';
printf( __( '<span class="entry-date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyfourteen' ), printf( __( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', 'twentyfourteen' ),
esc_url( get_permalink() ), esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ), esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ), esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'twentyfourteen' ), get_the_author() ) ),
get_the_author() get_the_author()
); );
} }

View File

@ -156,13 +156,11 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
endif; endif;
printf( __( '<span class="entry-date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyfourteen' ), printf( __( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5s</a></span></span>', 'twentyfourteen' ),
esc_url( get_permalink() ), esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ), esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ), esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'twentyfourteen' ), get_the_author() ) ),
get_the_author() get_the_author()
); );