-
Notifications
You must be signed in to change notification settings - Fork 43
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
Homepage Posts block: add optional 'continue reading' link underneath excerpts #656
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, except when using the "Load More" button I'm seeing 500 fatal errors like this:
PHP Fatal error: Uncaught Error: Call to undefined method Newspack_Blocks::remove_excerpt_ellipsis_filter() in /Users/dkoo/Local Sites/newspack/app/public/wp-content/plugins/newspack-blocks/src/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php:103
I think we just need to update some method names in the API controller as suggested below. Otherwise, looks good!
src/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php
Outdated
Show resolved
Hide resolved
src/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now!
🎉 This PR is included in version 1.18.0-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.18.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
This PR adds an option to add a customize-able 'Read More' link for each story on a per-post basis.
Unfortunately, current behaviour in WP.com themes could complicate this. This is a comment from me from the original enhancement request:
To work around this, I added a filter that should override any
entry_more
customization in the theme, switching it to...
when the 'Read More' link is turned on, then removing the filter so it falls back to whatever a theme might be doing for blocks that have it left off.Closes #495
Note: I've added the 'Don't Merge' tag so some theme styles can be added for this as well (there is a bit adding an arrow already, but it could use refining); in the meantime the block uses the comment class name
more-link
on the link, so it should pick up styles from most WordPress themes that it's already getting links from.How to test the changes in this Pull Request:
npm run build
Confirm on the front end and in the editor, your settings are respected, including the different read more link text, and, when enabled, that the default
[...]
is replaced with...
.Note: on the front-end, you can see that the
.more-link
already has styles in the theme, adding an arrow; that will be updated:Download Varia from WordPress.com and enable it on your test site.
View on the front end and confirm that Varia's custom
excerpt_more
filter ("Continue Reading") is being picked up on blocks that don't have the 'Read More' link set, but the ones with a 'Read More' link set should still be applying it. All of the links should be applying the arrow from Varia, since it also uses the.more-link
CSS class. (Note: Varia's custom filter will not be applied in the editor, since the theme only applies it to the front-end; in that case, the blocks without the 'Read More' link enabled should still fall back to the default[...]
):Other information: