Add lazy loading for fullwidth post slider
-
Hello,
when using the Divi Module “Fullwidth Post Slider” and set the featured image placement to “background” (which is the default), the plugin does not detect the slider.
Just replace the function lazy_load_slider_bg_check_if_needed() with the following:
function lazy_load_slider_bg_check_if_needed() { global $post; $slider = '/\[et_pb_slide[^\]]*background_image[^\]].*?\]/'; $post_slider = '/\[et_pb_fullwidth_post_slider(?:(?!image_placement).)*?\]/'; if (preg_match($slider, $post->post_content) || preg_match($post_slider, $post->post_content)) { add_action('wp_print_styles', 'lazy_load_slider_bg_add_header_css'); add_action('wp_print_footer_scripts', 'lazy_load_slider_bg_add_footer_js'); } }
The topic ‘Add lazy loading for fullwidth post slider’ is closed to new replies.