Make WordPress Core


Ignore:
Timestamp:
11/19/2014 06:26:17 PM (10 years ago)
Author:
lancewillett
Message:

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.

File:
1 edited

Legend:

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

    r30387 r30389  
    195195            the_post_thumbnail( 'twentyfourteen-full-width' );
    196196        } else {
    197             the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) ); 
     197            the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) );
    198198        }
    199199    ?>
     
    202202    <?php endif; // End is_singular()
    203203}
     204
     205if ( ! function_exists( 'twentyfourteen_excerpt_more' ) && ! is_admin() ) :
     206/**
     207 * Replaces "[...]" (appended to automatically generated excerpts) with ...
     208 * and a Continue reading link.
     209 *
     210 * @since Twenty Fourteen 1.3
     211 *
     212 * @param string $more Default Read More excerpt link.
     213 * @return string Filtered Read More excerpt link.
     214 */
     215function twentyfourteen_excerpt_more( $more ) {
     216    $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
     217        esc_url( get_permalink( get_the_ID() ) ),
     218            /* translators: %s: Name of current post */
     219            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>' )
     220        );
     221    return ' &hellip; ' . $link;
     222}
     223add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' );
     224endif;
Note: See TracChangeset for help on using the changeset viewer.