Plugin / Lazy Loader

Florian Brinkmann, MarcDK

Frequently Asked Questions (FAQ)

Yes. See the following example that would generate lazy-load-ready output for the result of the not-supported wp_get_attachment_image() function: if ( isset( $lazy_loader ) && $lazy_loader instanceof FlorianBrinkmann\LazyLoadResponsiveImages\Plugin ) { echo $lazy_loader->filter_markup( wp_get_attachment_image( 1261 ) ); } To make it happen, you need to pass the markup that contains the image (or images) to $lazy_loader->filter_markup(). The if statement ensures that the Lazy Loader object is there and that it is an object of the correct class.
Important: If you modify or remove the inline styles, also the style that shows the loading spinner is affected. So if you remove the styles or modify them without adding back the spinner styles, the spinner option will not work. I created a Gist with the spinner styles – just add them to your modification to make it work. To disable or modify the plugin’s inline styles (except the style that hides the img.lazyload elements when JS is disabled, so only the noscript version is displayed) you can use the lazy_load_responsive_images_inline_styles filter. For example, to remove the inline styles, use the following code: add_filter( 'lazy_load_responsive_images_inline_styles', function () { return ''; } ); If you want to modify it, you can do that like in the following code block (remember to include the opening and closing style tags for additions/replacements). The code modifies the duration of the fade-in-effect: add_filter( 'lazy_load_responsive_images_inline_styles', function ( $default_styles ) { $default_styles = sprintf( '%s ', $default_styles ); return $default_styles; } ); The CSS from the example are the default styles that are used by the plugin (without the loading spinner styles). The display: block for .lazyload is important for the aspectratio plugin option.
There is a textarea in the plugin settings where you can insert custom settings for the lazysizes config.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.