High performance and SEO friendly lazy loader for images, iframes and more
|Author:||Patrick Sletvold (profile at wordpress.org)|
|WordPress version required:||3.9|
|WordPress version tested:||5.2.1|
|Added to WordPress repository:||02-11-2017|
|Total downloads:||3 626|
Click to start download
Why aren’t my images lazy loading?
Lazysizes filters images added to the page using
get_avatar. If your images are added using another function (
wp_get_attachment_image for example), lazysizes does not filter them. However, you can filter the HTML yourself by passing it to
For example, if a theme has:
Changing it to the following would lazy load the image:
echo get_lazysizes_html( wp_get_attachment_image($id) );
But this plugin looks like Lazy Load XT!!
Yes, it does. The PHP code for this plugin is heavily based on that of Lazy Load XT.
The main difference is that this plugin is a bit simplified, and is using a completely different lazy loading library, with no jQuery dependency.
Thanks to dbhynds for making the Lazy Load XT plugin. Without that project, this one would not be possible.
Why is this plugin called the same as the lazysizes JS library?
There are a couple of reasons:
- I like the name. It’s good.
- I’m hoping it will help people discovering the plugin. I originally tried searching for a WordPress plugin using the library myself, and other people might be trying the same.
If you are wondering, this plugin is not affiliated with the lazysizes project. I got permission by aFarkas to use the name, but that’s as far as any connection between the two go.
- Upgrade lazysizes library to version 5.0.0.
- Add experimental support for native lazy loading.
- Fix fatal error during ajax processing. Thanks to @eastgate for reporting.
- Fix PHP warning on certain pages, like the events page from the plugin The Events Calendar. Thanks @julian_wave for reporting.
Big thanks to martychc23 and dutze for their help and patience in making this release as good as it is.
- Proper support for the picture tag, by popular request. Big refactoring of the HTML transforming code was done to make picture element support possible.
- Improve and fix support for audio/video elements. The plugin now handles the preload attribute and leaves the src attribute alone on source elements inside video/audio.
- Opt-in support for get_attachment_image. Please note that the plugin cannot add a no-js fallback for images lazy-loaded using this method.
- Add option to enable/disable noscript fallback
- Fix plugin action links
- Several fixes to improve compatibility
- Add support for the aspectratio plugin for lazysizes, which makes images have the right height while loading. Thanks to Teemu Suoranta (@teemusuoranta) for implementing.
- Update the lazysizes library to version 4.1.5
- Fix lazy loading of elements without a class attribute, like some iframes
- Fix translation loading
- Remove unused code for advanced settings
- Fix text domain loading
- Updated readme
- Initial version of the plugin