Disable Lazy Loading
-
Hi,
Thank you for this great plugin.
[EDIT, SOLVED]
Sorry for the false alarm. It’s solved.
I was writing to ask if the image on the author page could have lazy-loading=”eager”, since it’s the largest contentful paint there.
But, my code was incorrect.
This is the edited, correct / working version.// The avatar image is full size on the author page, but medum_large on other pages // On the author page, lazy loading is disabled, because the avatar is the largest contentful paint if ( is_author() ) { if (function_exists ( 'mt_profile_img' ) ) { $author_id = $post->post_author; $author_image = mt_profile_img( $author_id, array( 'size' => 'full', 'attr' => array( 'alt' => 'Author image', 'class' => 'avatar author-avatar', 'loading' => 'eager' ), 'echo' => false ) ); } } else { if (function_exists ( 'mt_profile_img' ) ) { $author_id = $post->post_author; $author_image = mt_profile_img( $author_id, array( 'size' => 'medium_large', 'attr' => array( 'alt' => 'Author image', 'class' => 'avatar author-avatar' ), 'echo' => false ) ); } } echo $author_image;Best regards,
Jovan
The topic ‘Disable Lazy Loading’ is closed to new replies.