Archived topic
Adding an Image class to the Site logo to skip lazyload
5 replies · Started by ahmad on November 24, 2020
Hey
I want to make the site logo skip lazyload for wp rocket
so they are saying I need to add a Skip lazy class
Examples:

where can I alter that in generatepress ?
Thanks
Hi,
You can check this brief documentation on how to add class to your site logo:
https://docs.generatepress.com/article/generate_logo_output/
Thanks
But i don’t understand where to put that code on the site ??
Sorry I dont understand coding at all
And where do i place the class inside that code ?
Thanks
Here's how to add PHP - https://docs.generatepress.com/article/adding-php/
You can pick between adding a child theme or using the Code Snippet plugin.
Code Snippet plugin may be easier as it doesn't require you to create child theme files for upload.
Within this code:
add_filter( 'generate_logo_output', 'tu_logo_class', 10, 3 );
function tu_logo_class( $output, $logo_url, $html_attr ) {
printf(
'<div class="site-logo MY-CUSTOM-CLASS">
<a href="%1$s" title="%2$s" rel="home">
<img %3$s />
</a>
</div>',
esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
$html_attr
);
}
Replace "MY-CUSTOM-CLASS" with your CSS class.
Thank you a lot this seems to work
appreciate it Elvin :)
No problem. Glad it works for you. :)