Site logo

[Resolved] Logo width and height in header

Home Forums Support [Resolved] Logo width and height in header

Home Forums Support Logo width and height in header

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1700109
    Chloe

    Hi there

    I am having a couple of issues with defining image sizes on my pages. The main one being the logo header image. I think if I can resolve this one then I should be able to resolve the other issue. I have tried to implement the solution here: https://generatepress.com/forums/topic/how-to-set-height-and-width-for-the-logo-image/#post-1563234, but it doesn’t seem to be working.

    I have included the link on Page speed insights. You can see there are two images, the logo and an author profile pic at the bottom of the page.

    Any help would be amazing.

    Many thanks

    Chloe

    #1700620
    Leo
    Staff
    Customer Support

    Hi there,

    The PHP snippet David provided should work for the mobile view.

    Are you referring to the desktop or mobile here?

    Let me know 🙂

    #1701669
    Chloe

    Hi Leo

    Thanks for your reply.

    It’s in mobile. I have added the snippet, the it is still coming up in insights as an issue.

    Thanks Chloe

    #1702394
    Leo
    Staff
    Customer Support

    David’s snippet is for the mobile header logo which you aren’t using.

    Try this snippet instead:

    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="330" height="58" 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 ) )
    	);
    }

    It should work for both desktop and mobile

    #1704946
    Chloe

    Hi Leo!

    This worked great. Thank you.

    Chloe

    #1705711
    Leo
    Staff
    Customer Support

    No problem 🙂

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