Does not work on all images
-
Hello,
i recently started using your plugin with my Ascend theme from Kadence Themes. Most of the pictures work fine.
But with some pictures from theme widgets it doesn’t seem to work.My theme developer has already implemented the code from your FAQ like this:
function ascend_lazy_load_filter() { $lazy = false; if(function_exists( 'get_rocket_option' ) && get_rocket_option( 'lazyload') ) { $lazy = true; } return apply_filters('kadence_lazy_load', $lazy); }
(…)
function ascend_get_image_output($width = null, $height = null, $crop = true, $class = null, $alt = null, $id = null, $placeholder = false, $lazy = false, $schema = true, $extra = null) { $img = ascend_get_image($width, $height, $crop, $class, $alt, $id, $placeholder); if($lazy) { if( ascend_lazy_load_filter() ) { $image_src_output = 'src="data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs=" data-lazy-src="'.esc_url($img['src']).'" '; } else { $image_src_output = 'src="'.esc_url($img['src']).'"'; } } else { $image_src_output = 'src="'.esc_url($img['src']).'"'; } if(!empty($img['src']) && $schema == true) { $output = '<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">'; $output .='<img '.$image_src_output.' width="'.esc_attr($img['width']).'" height="'.esc_attr($img['height']).'" '.$img['srcset'].' class="'.esc_attr($img['class']).'" itemprop="contentUrl" alt="'.esc_attr($img['alt']).'" '.$extra.'>'; $output .= '<meta itemprop="url" content="'.esc_url($img['src']).'">'; $output .= '<meta itemprop="width" content="'.esc_attr($img['width']).'px">'; $output .= '<meta itemprop="height" content="'.esc_attr($img['height']).'px">'; $output .= '</div>'; return $output; } elseif(!empty($img['src'])) { return '<img '.$image_src_output.' width="'.esc_attr($img['width']).'" height="'.esc_attr($img['height']).'" '.$img['srcset'].' class="'.esc_attr($img['class']).'" alt="'.esc_attr($img['alt']).'" '.$extra.'>'; } else { return null; } }
But only the class “lazyloading” is added. Noscript is missing and the images are always loaded immediately.
For example you can see it at the bottom of my Page under last posts(Letzte Beitr?ge).
https://www.floristmeister.de/Sorry for my bad english.
Best regardsThe page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Does not work on all images’ is closed to new replies.