fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Marvin Ramadan

Hello Support Team,

as shown on your Demo page you have enabled lazy load for gallery images, how can i turn of the the lazy load for the gallery images ?

screenshot.png

Golam Kibria

Hi Marvin,

Please add the following snippet to your child theme’s functions.php file:
add_filter( 'woo_variation_gallery_image_inner_html', function( $inner_html, $image, $template, $attachment_id, $options ){
$template = '<div class="wvg-single-gallery-image-container"><img width="%d" height="%d" src="%s" class="%s" alt="%s" title="%s" data-caption="%s" data-src="%s" data-large_image="%s" data-large_image_width="%d" data-large_image_height="%d" srcset="%s" sizes="%s" %s /></div>';

$inner_html = sprintf( $template, esc_attr( $image['src_w'] ), esc_attr( $image['src_h'] ), esc_url( $image['src'] ), esc_attr( $image['class'] ), esc_attr( $image['alt'] ), esc_attr( $image['title'] ), esc_attr( $image['caption'] ), esc_url( $image['full_src'] ), esc_url( $image['full_src'] ), esc_attr( $image['full_src_w'] ), esc_attr( $image['full_src_h'] ), esc_attr( $image['srcset'] ), esc_attr( $image['sizes'] ), $image['extra_params'] );

return $inner_html;
}, 10, 5);

Let me know if this helps resolve the issue.
Thank You

Marvin Ramadan

It’s not really changing anything for me, i still see all the lazy load inside the code.

Marvin Ramadan

Hello Golam,

the pictures are still loaded lazy, you filter is not working for me, do you have tested the filter in your demo environment ?

Golam Kibria

Hi Marvin,

I think the default WordPress lazy load is coming into action.

Please add the following filter after the above snippet:
add_filter( ‘wp_calculate_image_srcset_meta’, ‘__return_null’ );

Let me know if this helps.

Thank You

Marvin Ramadan

Hello Support Team,

i need to reopen this ticket, because the fix with the above filters isn’t working anymore.

May you have a smoother workaround to disable the lazy load. I would be finde with disabling the lazy load totally.

Hope you can help me once again.

 

kind regards

marvin

Golam Kibria

Hi Marvin,

I hope that you are doing great.

Apologies for the delayed response (we had a holiday).

Please add the following filter to your child theme’s functions.php file:

add_filter( 'wp_lazy_loading_enabled', '__return_false' );

Let me know if this helps.

Thank You

Marvin Ramadan

Hello Golam,

this was not helping at all. I also dont want to turn off lazy load globally, just for the Gallery plugin 🙂

 

So maybe it’s possible to turn out lazy load completly by css class or in your plugin ?

thank you in advance

Golam Kibria

Hi Marvin,

I apologize for the inconvenience you have faced.

Please remove all the previous snippets and add the following snippet to your child theme’s functions.php file

Copy the snippet from this URL.

I will wait for your feedback.

Thank You