-
Notifications
You must be signed in to change notification settings - Fork 798
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
Lazy Images: Allow filtering out images via class and attributes #8787
Conversation
f809c6b
to
3de68e9
Compare
3de68e9
to
ac9ad8e
Compare
Tested. Unfortunately I haven't noticed any difference in the way the featured images load on the home page with Lazy Images turned on. My comprison was against master and against this PR. But I do notice some difference on the individual post view. I'm testing again and getting some screencaps |
Is this with the Gazette theme? Ideally, you wouldn't see differences with the featured content that shows at the very top of the theme since we'd be skipping those images. |
Hey @oskosk – can you provide a bit more detail? You mentioned some screenshots in your last comment. |
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.
LGTM
So, following the testing instructions is that I noticed no difference on the homepage. Indeed with the Gazette theme. The screenshots I mentioned are related to Lazy images and gazette but on the single post view. That super high block that appears on the single post view is seen when Lazy Images is turned on, both on latest stable and in this PR. |
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.
As explained in slack, seeing no differences in the homepage for gazette implies that this changeset works fine. LGTM!
* update changelog.txt * Update readme.txt with scaffolding for 5.9 changelog and release draft shortlink * Add changelog entry for #8243 * Add changelog entry for #8296 * Add changelog entry for #8367 * Add changelog entry for #8686 * Add changelog entry for #8707 * Add changelog entry for #8709 and #8714 * Add changelog entry for #8729 * Add changelog entry for #8777 * Add changelog entry for #8780 * Add changelog entry for #8786 * Add changelog entry for #8787 * Add changelog entry for #8801 #8805 #8832 #8865 and #8804 * Add changelog entry for #8817 * Add changelog entry for #8822 * Add changelog entry for #8823 * Add changelog entry for #8829 * Add changelog entry for #8834 * move some items to major enhancements * Add changelog entry for #8836 * Add changelog entry for #8839 * Add changelog entry for #8861 * Add changelog entry for #8862 * Add changelog entry for #8863 * Add changelog entry for #8866 * Add changelog entry for #8870 * Add changelog entry for #8874 * Add changelog entry for #8875 * Add changelog entry for #8881 * Add changelog entry for #8890 * Add changelog entry for #8911 * Add changelog entry for #8927 * Add changelog entry for #8931 * Add changelog entry for #8933 * Add changelog entry for #8930 * fix wording * typo * minor fixes * replace partner scripts for Jetpack Start in changelog entry * Update to-test.md * Update to-test.md * minor style fixes to to-test.md * minor style fixes to to-test.md * minor fixes on to-test.md * Add changelog entry for #8868 * Add changelog entry for #8844 * Add changelog entry for #8664 * Add changelog entry for #8935 * Add changelog entry for #8425 * Add changelog entry for #8625
It's funny how half an year later no one noticed the typo in one of these filters. |
Hi @boiangeorgiev – Thank you for the report. I have created #10002 to address the typo. |
Closes #8785
Closes #8641
In #8641, a user requests the ability to skip processing images with a given class.
In #8745, a user reports a compatibility issue with another plugin where we shouldn't be processing an image so that it's lazy. After looking at the plugin's code, I don't see any specific classes that we can hook on.
These two issues go pretty well together. 😄
This PR will begin skipping images where the
skip-lazy
class is applied. Further, a user can filterjetpack_lazy_images_blacklisted_classes
to add or remove classes to the list of classes that we'll skip.I've also added a filter that will allow skipping an image via its attributes. The
jetpack_lazy_images_skip_image_with_atttributes
receives an array of the current image's attributes as its second argument. Filters can hook on this, examine the attributes, and decide whether to skip the image or not.These two methods of skipping images should provide a good amount of flexibility for plugins and themes.
To test:
phpunit --testsuite=lazy-images
Note: there is currently a test that does not assert anything. That is not related to this PR. Lazy Images: Fixes test that had no assertion #8788 fixes that test.(Merged already)Changelog entry