Hi ,
I use newpaper-x (with a child theme) with lazy load for content disabled (“newspaper_x_enable_blazy” = false).
So lazy load is only used by widgets to display thumbnails and featured images (not all site images).
I had troubles with Internet Explorer so I wanted to remove the lazy load for IE . I did that by modifying directly the code of class-newspaper-x-lazyload.php. in the “father” theme.
I replaced the original code
if ( $lazy ) {
$browser = $this->check_browser_version();
if ( $browser[‘name’] === ‘Internet Explorer’ ) {
…
add_filter( ‘wp_calculate_image_sizes’, ‘__return_false’, PHP_INT_MAX );
add_filter( ‘wp_calculate_image_srcset’, ‘__return_false’, PHP_INT_MAX );
remove_filter( ‘the_content’, ‘wp_make_content_images_responsive’ );
}
add_filter( ‘the_content’, array( $this, ‘filter_lazyload_content’ ) );
}
By
$browser = $this->check_browser_version();
if ( $browser[‘name’] === ‘Internet Explorer’ ) {
…
add_filter( ‘wp_calculate_image_sizes’, ‘__return_false’, PHP_INT_MAX );
add_filter( ‘wp_calculate_image_srcset’, ‘__return_false’, PHP_INT_MAX );
remove_filter( ‘the_content’, ‘wp_make_content_images_responsive’ );
}
if ( $lazy ) {
add_filter( ‘the_content’, array( $this, ‘filter_lazyload_content’ ) );
}
This changes is to disable IE even if $lazy is false … It works fine … But it is a temporary workaround because I will lost the modifications when updating the them
My questions :
- is is the right way to do that ?
- why have you restricted the IE check/disable only if $lazy == 1 ?
- Is my change could be considered as a permanent change in the newspaper-x theme ?
Please let me know
newpaper-x is a wonderful theme, thank you
JP