Make WordPress Core


Ignore:
Timestamp:
11/04/2014 09:18:22 PM (10 years ago)
Author:
iandstewart
Message:

Twenty Fifteen: use continue reading links for auto-generated excerpts to provide a readable link for screenreaders.

Props davidakennedy, kraftbj, fixes #30135.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfifteen/inc/template-tags.php

    r30232 r30237  
    221221}
    222222endif;
     223
     224if ( ! function_exists( 'twentyfifteen_excerpt_more' ) && ! is_admin() ) :
     225/**
     226 * Replaces "[...]" (appended to automatically generated excerpts) with ... and a Continue reading link.
     227 *
     228 * @since Twenty Fifteen 1.0
     229 *
     230 */
     231function twentyfifteen_excerpt_more( $more ) {
     232    $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
     233        esc_url( get_permalink( get_the_ID() ) ),
     234        /* translators: %s: Name of current post */
     235        sprintf( esc_html__( 'Continue reading %s', 'twentyfifteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
     236        );
     237    return ' &hellip; ' . $link;
     238}
     239add_filter( 'excerpt_more', 'twentyfifteen_excerpt_more' );
     240endif;
Note: See TracChangeset for help on using the changeset viewer.