Lazy load images to improve page load times and server bandwidth. Images are loaded only when visible to the user.
Author: | Mohammad Jangda (profile at wordpress.org) |
WordPress version required: | 3.2 |
WordPress version tested: | 5.0 |
Plugin version: | 0.6.1 |
Added to WordPress repository: | 24-11-2011 |
Last updated: | 22-11-2018
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 80 |
Rated by: | 53 |
Plugin URI: | |
Total downloads: | 509 595 |
Active installs: | 30 000+ |
Click to start download
|
FAQ
How do I change the placeholder image
add_filter( ‘lazyload_images_placeholder_image’, ‘my_custom_lazyload_placeholder_image’ );
function my_custom_lazyload_placeholder_image( $image ) {
return ‘http://url/to/image’;
}
How do I lazy load other images in my theme?
You can use the lazyload_images_add_placeholders helper function:
if ( function_exists( 'lazyload_images_add_placeholders' ) )
$content = lazyload_images_add_placeholders( $content );
Or, you can add an attribute called “data-lazy-src” with the source of the image URL and set the actual image URL to a transparent 1×1 pixel.
You can also use output buffering, though this isn’t recommended:
if ( function_exists( 'lazyload_images_add_placeholders' ) )
ob_start( 'lazyload_images_add_placeholders' );
This will lazy load all your images.
ChangeLog
0.6.1
0.6
- Filter to control when lazy loading is enabled
0.5
- Fix lazyload_images_add_placeholders by adding missing return, props Kevin Smith
- Lazy load avatars, props i8ramin
- Don’t lazy load images in the Dashboard
- Better compatibility with Jetpack Carousel
0.4
- New helper function to lazy load non-post content
- Prevent circular lazy-loading
0.3
- Make LazyLoad a static class so that it’s easier to change its hooks
- Hook in at a higher priority for content filters
0.2
- Adds noscript tags to allow the image to show up in no-js contexts (including crawlers), props smub
- Lazy Load post thumbnails, props ivancamilov
0.1