[Support request] Adding an Image class to the Site logo to skip lazyload

Home Forums Support [Support request] Adding an Image class to the Site logo to skip lazyload

Home Forums Support Adding an Image class to the Site logo to skip lazyload

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1545001
    ahmad

    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

    #1545027
    Elvin
    Staff
    Customer Support

    Hi,

    You can check this brief documentation on how to add class to your site logo:
    https://docs.generatepress.com/article/generate_logo_output/

    A wise man once said:
    "Have you cleared your cache?"

    #1545037
    ahmad

    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

    #1545049
    Elvin
    Staff
    Customer Support

    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.

    A wise man once said:
    "Have you cleared your cache?"

    #1545871
    ahmad

    Thank you a lot this seems to work
    appreciate it Elvin 🙂

    #1547064
    Elvin
    Staff
    Customer Support

    No problem. Glad it works for you. 🙂

    A wise man once said:
    "Have you cleared your cache?"

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.