I maintain a lazy loading plugin, that got a bigger update a few days ago. Among other things, it was renamed to Lazy Loader, because it not only supports »only« images with the new version.
The plugin uses the small lazysizes script by Alexander Farkas. In a support thread, a user raised the question if it would be possible to include the unveilhooks extension of the script in the WordPress plugin, which allows things like lazy loading of background images. After that, I started with a bigger update, that contains the following changes:
Supporting more elements
Since version 3.2.0, the plugin supports – besides images – the auto-modification of the markup for lazy loading of the following elements in post content and widgets (you need to enable support for those elements via the plugin options under Settings › Media › Lazy Loader options):
- Audio elements (needs the unveilhooks extension of lazysizes and loads it automatically, if the option is enabled).
- Video elements (also needs the unveilhooks script and loads it).
One other new option allows you to load the unveilhooks plugin regardless of the state of the audio and video options. With manual adjustment of the markup and loading the unveilhooks extension, you can also use lazy loading for the following elements:
- Background images.
Besides the post content, the plugin now also supports widgets and Gravatars.
Moving the options to the media settings screen
The plugin options (until now that was only one option) lived in the customizer. After thinking about that, the customizer does not seem to be the right place for that kind of options, so I moved them to the media settings screen.
If you need a lazy loading plugin, give it a try 🙂