[Resolved] How to add width and height attributes to logo

Home Forums Support [Resolved] How to add width and height attributes to logo

Home Forums Support How to add width and height attributes to logo

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1496437
    Enrico

    Hi there.
    I’m trying to add the missing width=’ ‘ and height=’ ‘ attributes to the logo image tag. Unfortunately, no success.
    I tried a solution that I found here, but it works not 100%
    I added this code in functions.php:

    add_filter( 'generate_logo_output','tu_logo_atts', 10, 2 );
    function tu_logo_atts( $output, $logo ) {
    	printf( 
    		'<div class="site-logo">
    			<a href="%1$s" title="%2$s" rel="home">
    				<img width="200" height="200" class="header-image" src="%3$s" alt="%2$s" title="%2$s" />
    			</a>
    		</div>',
    		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
    		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
    		esc_url( apply_filters( 'generate_logo', $logo ) )
    	);
    }

    But in this way the logo isn’t show in the home page (page-hero-logo), although I can see it in source code of the page:
    In the others pages, it works well.
    The URL of my site is: https://guide-dolomiti.it/
    Please, may you help me?
    Thank you.

    #1496645
    David
    Staff
    Customer Support

    Hi there,

    try adding this CSS:

    .header-wrap .main-navigation .site-logo {
        display: block;
    }
    #1497199
    Enrico

    Thank you very much, it works well!
    Ciao.

    #1497365
    David
    Staff
    Customer Support

    You’re welcome

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