Make WordPress Core


Ignore:
Timestamp:
10/29/2015 01:20:04 PM (9 years ago)
Author:
SergeyBiryukov
Message:

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

Props swissspidy.
Fixes #34481.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/embed-functions.php

    r35406 r35432  
    747747
    748748/**
    749  * Filters the string in the "more" link displayed after a trimmed excerpt.
    750  *
    751  * @since 4.4.0
    752  *
    753  * @param string $more_string The string shown within the more link.
    754  * @return string The modified excerpt.
     749 * Filters the string in the 'more' link displayed after a trimmed excerpt.
     750 *
     751 * Replaces '[...]' (appended to automatically generated excerpts) with an
     752 * ellipsis and a "Continue reading" link in the embed template.
     753 *
     754 * @since 4.4.0
     755 *
     756 * @param string $more_string Default 'more' string.
     757 * @return string 'Continue reading' link prepended with an ellipsis.
    755758 */
    756759function wp_embed_excerpt_more( $more_string ) {
     
    759762    }
    760763
    761     return sprintf(
    762         _x( '… %s', 'read more link' ),
    763         sprintf(
    764             '<a class="wp-embed-more" href="%s" target="_top">%s</a>',
    765             get_the_permalink(),
    766             __( 'Read more' )
    767         )
     764    $link = sprintf( '<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>',
     765        esc_url( get_permalink() ),
     766        /* translators: %s: Name of current post */
     767        sprintf( __( 'Continue reading %s' ), '<span class="screen-reader-text">' . get_the_title() . '</span>' )
    768768    );
     769    return ' &hellip; ' . $link;
    769770}
    770771
Note: See TracChangeset for help on using the changeset viewer.