Twenty Nineteen: Add "Continue reading" link for post excerpts.
This ensures that archive pages have a meaningful link text after the excerpts. Props metalandcoffee, alex27, sabernhardt, mdrockwell, laurelfulford. Fixes #46177. Built from https://develop.svn.wordpress.org/trunk@49831 git-svn-id: http://core.svn.wordpress.org/trunk@49550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f124a2e529
commit
fa7e570e2a
|
@ -204,6 +204,30 @@ function twentynineteen_widgets_init() {
|
||||||
}
|
}
|
||||||
add_action( 'widgets_init', 'twentynineteen_widgets_init' );
|
add_action( 'widgets_init', 'twentynineteen_widgets_init' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces "[...]" (appended to automatically generated excerpts) with ... and
|
||||||
|
* a 'Continue reading' link.
|
||||||
|
*
|
||||||
|
* @since Twenty Nineteen 2.6
|
||||||
|
*
|
||||||
|
* @param string $link Link to single post/page.
|
||||||
|
* @return string 'Continue reading' link prepended with an ellipsis.
|
||||||
|
*/
|
||||||
|
function twentynineteen_excerpt_more( $link ) {
|
||||||
|
if ( is_admin() ) {
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = sprintf(
|
||||||
|
'<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>',
|
||||||
|
esc_url( get_permalink( get_the_ID() ) ),
|
||||||
|
/* translators: %s: Post title. */
|
||||||
|
sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentynineteen' ), get_the_title( get_the_ID() ) )
|
||||||
|
);
|
||||||
|
return ' … ' . $link;
|
||||||
|
}
|
||||||
|
add_filter( 'excerpt_more', 'twentynineteen_excerpt_more' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the content width in pixels, based on the theme's design and stylesheet.
|
* Set the content width in pixels, based on the theme's design and stylesheet.
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.7-alpha-49830';
|
$wp_version = '5.7-alpha-49831';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue