Make WordPress Core

Ticket #46177: 46177.diff

File 46177.diff, 1.2 KB (added by metalandcoffee, 4 years ago)
  • src/wp-content/themes/twentynineteen/functions.php

    diff --git a/src/wp-content/themes/twentynineteen/functions.php b/src/wp-content/themes/twentynineteen/functions.php
    index ed23d3e0d9..df1388b943 100644
    a b function twentynineteen_widgets_init() { 
    204204}
    205205add_action( 'widgets_init', 'twentynineteen_widgets_init' );
    206206
     207/**
     208 * Replaces "[...]" (appended to automatically generated excerpts) with ... and
     209 * a 'Continue reading' link.
     210 *
     211 * @param string $link Link to single post/page.
     212 * @return string 'Continue reading' link prepended with an ellipsis.
     213 */
     214function twentynineteen_excerpt_more( $link ) {
     215        if ( is_admin() ) {
     216                return $link;
     217        }
     218
     219        $link = sprintf(
     220                '<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>',
     221                esc_url( get_permalink( get_the_ID() ) ),
     222                /* translators: %s: Post title. */
     223                sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentynineteen' ), get_the_title( get_the_ID() ) )
     224        );
     225        return ' &hellip; ' . $link;
     226}
     227add_filter( 'excerpt_more', 'twentynineteen_excerpt_more' );
     228
    207229/**
    208230 * Set the content width in pixels, based on the theme's design and stylesheet.
    209231 *