Embeds: Include post name in "Continue reading" links to provide a readable link for screenreaders.

Props swissspidy.
Fixes #34481.
Built from https://develop.svn.wordpress.org/trunk@35432


git-svn-id: http://core.svn.wordpress.org/trunk@35396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-10-29 13:21:26 +00:00
parent 1b0bc28579
commit a3aaa0f951
2 changed files with 12 additions and 11 deletions

View File

@ -746,26 +746,27 @@ function wp_filter_oembed_result( $result, $data, $url ) {
} }
/** /**
* Filters the string in the "more" link displayed after a trimmed excerpt. * Filters the string in the 'more' link displayed after a trimmed excerpt.
*
* Replaces '[...]' (appended to automatically generated excerpts) with an
* ellipsis and a "Continue reading" link in the embed template.
* *
* @since 4.4.0 * @since 4.4.0
* *
* @param string $more_string The string shown within the more link. * @param string $more_string Default 'more' string.
* @return string The modified excerpt. * @return string 'Continue reading' link prepended with an ellipsis.
*/ */
function wp_embed_excerpt_more( $more_string ) { function wp_embed_excerpt_more( $more_string ) {
if ( ! is_embed() ) { if ( ! is_embed() ) {
return $more_string; return $more_string;
} }
return sprintf( $link = sprintf( '<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>',
_x( '&hellip; %s', 'read more link' ), esc_url( get_permalink() ),
sprintf( /* translators: %s: Name of current post */
'<a class="wp-embed-more" href="%s" target="_top">%s</a>', sprintf( __( 'Continue reading %s' ), '<span class="screen-reader-text">' . get_the_title() . '</span>' )
get_the_permalink(),
__( 'Read more' )
)
); );
return ' &hellip; ' . $link;
} }
/** /**

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-beta2-35431'; $wp_version = '4.4-beta2-35432';
/** /**
* 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.