-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest Posts: Read more links have identical text and ignore excerpt_more
filter from themes
#55026
Comments
The solution for this could be similar to what is proposed in #51213, with a special class on the link and either an $trimmed_excerpt = get_the_excerpt( $post );
// Add "Read more" link with screen reader text.
if ( str_ends_with( $trimmed_excerpt, ' […]' ) ) {
$trimmed_excerpt .= sprintf(
' <a class="wp-block-latest-posts__post-read-more" href="%1$s" rel="noopener noreferrer">%2$s</a>',
esc_url( $post_link ),
/* translators: %s: Post title. Only visible to screen readers. */
sprintf( __( 'Read more<span class="screen-reader-text"> of “%s”</span>' ), esc_html( $title ) )
);
}
if ( post_password_required( $post ) ) {
$trimmed_excerpt = __( 'This content is password protected.' );
} |
The (unnamed) |
Thanks for filing this issue @sabernhardt I'll take another shot at rectifying it |
I'm thinking that the plugin, also in the editor, should treat the default excerpt value as Previously, the editor had always rendered "Read more" by default, so it looks like the editor should been made to conform to the frontend's default behaviour, and not the other way around. Also good point about the accessibility deficiency. Thanks for raising it 👍🏻 The only inconsistency I expect is that, if a theme such as 2021 et. al., returns a value from the Given that's the current state of things (and has been forever) I believe it's acceptable (?). |
First draft here: #55026 I've also flagged this issue on the 6.4 editor tasks board. |
Actually now I've had the chance to reflect, I think I remember why we did use the It was so that choices of the user in the editor were reflected on the frontend, even if those changes overrode theme custom text. Theme custom text would still display if I'm not suggesting either approach is better than the other, just documenting the motivation. |
@felixarntz and @swissspidy started a discussion about including the "Read more" text within the same translatable string as the link. If we keep the
I like "Read more of" the post, though "Read more about" is probably just as good. |
Thanks for cross posting here @sabernhardt I saw that discussion. I'll backport any changes made to Core into Gutenberg. If we were to go with a preposition, I think "about" is more appropriate in English. |
Description
When #51190 matched the front end to the editor, instead of matching the editor to the front end, it created two problems:
excerpt_more
hook, on the standard priority, this replaces filters that themes have used to add custom unique links in place of the ellipsis. That includes the bundled themes from Twenty Thirteen to Twenty Nineteen and Twenty Twenty-One.Related: Trac 59409
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Twenty Twenty-Three had the bracketed ellipsis in WordPress 6.2
WordPress 6.3 added "Read more" links to each post excerpt
Twenty Twenty-One's "Continue reading" links applied to the post excerpts with the Latest Posts block in WordPress 6.2
WordPress 6.3 replaced the theme's text with "Read more" links
Environment info
WordPress 6.3, with or without Gutenberg 16.7.0
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: