Disable cache on images of post by adding class “skip-lazy”

[ad_1]

Hi there,

I was able to disable lazy loading for images using the class method by adding “skip-lazy” to the thumbnail and above the fold images.

I added this code with ambition to disable lazy loading for posts with the print query:

if (isset($_GET['print']) && ($_GET['print'] == 1)) {
add_filter('get_image_tag_class','et_add_image_class');
}
function et_add_image_class ($class){
    $class .= ' skip-lazy';
    return $class;
}

But the class gets overrided by W3 Total Cache.

Please how can I add the classes to all images and not have W3TC override them? Thanks in advance.

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer