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

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


git-svn-id: http://core.svn.wordpress.org/trunk@30387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2014-11-19 18:35:21 +00:00
parent f398bd07ce
commit bbdafdc925
11 changed files with 111 additions and 20 deletions

View File

@ -10,8 +10,15 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentythirteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
?>
</div><!-- .entry-content -->
<footer class="entry-meta">

View File

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

View File

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

View File

@ -21,8 +21,15 @@
<div class="entry-content">
<?php if ( is_single() || ! get_post_gallery() ) : ?>
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentythirteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
?>
<?php else : ?>
<?php echo get_post_gallery(); ?>
<?php endif; // is_single() ?>

View File

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

View File

@ -21,8 +21,15 @@
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentythirteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
?>
</div><!-- .entry-content -->
<?php if ( is_single() ) : ?>

View File

@ -10,8 +10,15 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentythirteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
?>
</div><!-- .entry-content -->
<footer class="entry-meta">

View File

@ -10,8 +10,15 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentythirteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">&rarr;</span>', false )
) );
wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
?>
</div><!-- .entry-content -->
<footer class="entry-meta">

View File

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

View File

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

View File

@ -461,6 +461,27 @@ function twentythirteen_get_link_url() {
return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
}
if ( ! function_exists( 'twentythirteen_excerpt_more' ) && ! is_admin() ) :
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ...
* and a Continue reading link.
*
* @since Twenty Thirteen 1.4
*
* @param string $more Default Read More excerpt link.
* @return string Filtered Read More excerpt link.
*/
function twentythirteen_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', 'twentythirteen' ), '<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', 'twentythirteen_excerpt_more' );
endif;
/**
* Extend the default WordPress body classes.
*