Make WordPress Core

Ticket #36572: 36572.2.diff

File 36572.2.diff, 1.8 KB (added by flixos90, 9 years ago)

improve the excerpt more text as well

  • src/wp-includes/formatting.php

     
    29062906                 * @param int $number The number of words. Default 55.
    29072907                 */
    29082908                $excerpt_length = apply_filters( 'excerpt_length', 55 );
     2909
     2910                $more_string = ' […]';
    29092911                /**
    29102912                 * Filter the string in the "more" link displayed after a trimmed excerpt.
    29112913                 *
     
    29132915                 *
    29142916                 * @param string $more_string The string shown within the more link.
    29152917                 */
    2916                 $excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
     2918                $excerpt_more = apply_filters( 'excerpt_more', $more_string );
     2919
     2920                // add a more accessible default including a link if the `excerpt_more` filter is not used.
     2921                if ( $more_string === $excerpt_more ) {
     2922                        $excerpt_more = ' <a href="' . get_permalink() . '" class="more-link">' . sprintf(
     2923                                __( '<span class="screen-reader-text">Continue reading %s</span><span aria-hidden="true">[&hellip;]</span>' ),
     2924                                get_the_title()
     2925                        ) . '</a>';
     2926                }
     2927
    29172928                $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    29182929        }
    29192930        /**
  • src/wp-includes/post-template.php

     
    263263        $post = get_post();
    264264
    265265        if ( null === $more_link_text )
    266                 $more_link_text = __( '(more&hellip;)' );
     266                /* translators: %s: Name of current post */
     267                $more_link_text = sprintf(
     268                        __( '<span class="screen-reader-text">Continue reading %s</span><span aria-hidden="true">(more&hellip;)</span>' ),
     269                        get_the_title()
     270                );
    267271
    268272        $output = '';
    269273        $has_teaser = false;