Out of Date Documentation on Rocket LazyLoad Plugin
-
Working on adding manual support for my SEO theme which uses images outside the standard media upload functions for thumbnails (created on the fly, sort of) on archives and widgets: Rocket Lazyload doesn’t add the lazyload code to the image output.
Found your documentation on this at https://docs.wp-rocket.me/article/130-manually-apply-lazyload-to-an-image and it’s out of date and incomplete.
<?php $image = get_field( 'image' ); if( ! empty( $image ) && function_exists( 'get_rocket_option' ) && get_rocket_option( 'lazyload' ) : ?> <img src="data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs=" data-lazy-src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> <?php elseif( ! empty( $image ) ) : ?> <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> <?php endif; ?>
Looks like you changed the function
get_rocket_option
torocket_lazyload_get_option
and split the options to images etc…It’s also an incomplete solution, the above suggested code doesn’t include the noscript tag for visitors not using javascript as well.
Working on the code now for my theme, if you have an up to date solution would save me time if you have an up to date solution?
Thanks…
- The topic ‘Out of Date Documentation on Rocket LazyLoad Plugin’ is closed to new replies.