Site logo

Archived topic

How to add width and height attributes to logo

3 replies · Started by Enrico on October 19, 2020

Viewing posts 1–4 of 4

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.

Hi there,

try adding this CSS:

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

Thank you very much, it works well!
Ciao.

You're welcome

This archived topic is closed to new replies.