Make WordPress Core


Ignore:
Timestamp:
11/19/2014 06:34:45 PM (11 years ago)
Author:
lancewillett
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentythirteen/functions.php

    r28699 r30390  
    462462}
    463463
     464if ( ! function_exists( 'twentythirteen_excerpt_more' ) && ! is_admin() ) :
     465/**
     466 * Replaces "[...]" (appended to automatically generated excerpts) with ...
     467 * and a Continue reading link.
     468 *
     469 * @since Twenty Thirteen 1.4
     470 *
     471 * @param string $more Default Read More excerpt link.
     472 * @return string Filtered Read More excerpt link.
     473 */
     474function twentythirteen_excerpt_more( $more ) {
     475    $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
     476        esc_url( get_permalink( get_the_ID() ) ),
     477            /* translators: %s: Name of current post */
     478            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>' )
     479        );
     480    return ' &hellip; ' . $link;
     481}
     482add_filter( 'excerpt_more', 'twentythirteen_excerpt_more' );
     483endif;
     484
    464485/**
    465486 * Extend the default WordPress body classes.
Note: See TracChangeset for help on using the changeset viewer.