Hi guys,
WP-Rocket is running on my website but Lazy Load is not working with Flexible Masonry Element. I found a PHP-Code on the German WP-Rocket-Guide which seems to fix the issue. You can find the PHP-Code here at the bottom:
https://de.docs.wp-rocket.me/article/446-lazyload-manuell-fur-ein-bild-aktivieren
The code is:
<?php
$image = get_field( 'image' );
if( ! empty( $image )
&& function_exists( 'get_rocket_option' )
&& get_rocket_option( 'lazyload' )
&& ! ( defined( 'DONOTROCKETOPTIMIZE' ) && DONOTROCKETOPTIMIZE )
) : ?>
<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; ?>
How can I use the code in my Enfold Child Theme?
Best regards
Michael
Hey elskeletto1,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
Basilis