Twenty Fourteen: replace ellipses appended to automatically generated excerpts with both ellipses and a "Continue Reading" link to meet accessibility-ready requirements.

Props davidakennedy, lancewillett. Fixes #30176.
Built from https://develop.svn.wordpress.org/trunk@30389


git-svn-id: http://core.svn.wordpress.org/trunk@30386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2014-11-19 18:27:22 +00:00
parent 5c6de0c973
commit f398bd07ce
9 changed files with 70 additions and 9 deletions

View File

@ -43,7 +43,12 @@
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); /* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',

View File

@ -43,7 +43,12 @@
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); /* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',

View File

@ -43,7 +43,12 @@
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); /* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',

View File

@ -43,7 +43,12 @@
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); /* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',

View File

@ -43,7 +43,12 @@
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); /* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',

View File

@ -43,7 +43,12 @@
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); /* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',

View File

@ -43,7 +43,12 @@
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); /* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',

View File

@ -51,7 +51,12 @@
<?php else : ?> <?php else : ?>
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); /* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',

View File

@ -201,3 +201,24 @@ function twentyfourteen_post_thumbnail() {
<?php endif; // End is_singular() <?php endif; // End is_singular()
} }
if ( ! function_exists( 'twentyfourteen_excerpt_more' ) && ! is_admin() ) :
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ...
* and a Continue reading link.
*
* @since Twenty Fourteen 1.3
*
* @param string $more Default Read More excerpt link.
* @return string Filtered Read More excerpt link.
*/
function twentyfourteen_excerpt_more( $more ) {
$link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Name of current post */
sprintf( esc_html__( 'Continue reading %s', 'twentyfourteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span> <span class="meta-nav">&rarr;</span>' )
);
return ' &hellip; ' . $link;
}
add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' );
endif;