We do have exclude of different types of inages once you enable it. However we will be adding more exclude optons in the upcoming updates.
Thread Starter
Sam-wa
(@sam-wa)
We updated to the latest version and still the image exclusion feature is not available 🙁
-
This reply was modified 7 years, 3 months ago by
Sam-wa.
-
This reply was modified 7 years, 3 months ago by
Sam-wa.
Did you try the sub-options of the Lazy Load? What exactly you want to exclude image names or urls?
Thread Starter
Sam-wa
(@sam-wa)
In most cases (client sites) we want to exclude images in certain sections of the page. For example we want to exclude all product images from lazy loading.
If the plugin has an option to exclude images using image id or class (or div) that should be great.
Yeah, we did that but didn’t add it to 5.1 because we wanted a bit more testing. You can download this version of the plugin and try it out:
https://sgoptimizer.com/sg-cachepress.zip
Use this filter in the functions.php file of your theme once you do that:
add_filter( 'sgo_lazy_load_exclude_classes', 'exclude_image_from_lazy_load' );
function exclude_image_from_lazy_load($classes) {
$classes[] = 'class1';
$classes[] = 'class2';
return $classes;
}
Of course, replace class1, class2 with the actual classes you want to exclude from the Lazy Load. Let me know how that works for you 🙂
Is there a way to simply add an attribute to an image to exclude it from lazy loading?
I think with wprocket you can just add data-no-lazy=”1″ to an image and it won’t be lazy loaded.