- This topic has 5 replies, 3 voices, and was last updated 4 years, 8 months ago by
Elvin.
-
AuthorPosts
-
June 19, 2021 at 10:45 am #1827793
Dong
Hi guys,
I have the logo’s explicit height and width issue:
https://developers.google.com/speed/pagespeed/insights/?url=dongknows.com
Currently, I have this issue with (just) the logo image. The code Elvin mentioned here:
fix the logo error but subequently caused the same error on ALL featured images of the Archive page. Here’s the code I used:
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="341" height="132" src="%3$s" alt="%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 ) ) ); }Please help!
Thanks,
-Dong.
June 19, 2021 at 5:51 pm #1827983David
StaffCustomer SupportHi there,
see Tom’s reply here:
https://generatepress.com/forums/topic/logo-does-not-have-explicit-width-and-height/#post-1762272
Make sure to only add the code that Tom provided there, the one you shared above is not required.
June 19, 2021 at 5:55 pm #1827984Dong
That fixed it. Thanks, David.
June 19, 2021 at 6:13 pm #1827994David
StaffCustomer SupportGlad to hear that!
June 20, 2021 at 9:01 pm #1829068Dong
Actually, David, I spoke too soon. The code caused the error on ALL the featured photos of the archive page.
Without the code, ONLY the logo had the issue.
Any advice?
Thanks,
-Dong.
June 20, 2021 at 9:29 pm #1829082Elvin
StaffCustomer SupportHi Dong,
I believe there’s no need for this code if you’re already using GP Premium 2.0 or newer.
To fix this, you simply have to reupload and reassign it again on the Site Identity settings. This should generate the missing attributes.
Note: The code snippet I’ve provided only works with the logo. It shouldn’t affect any other images. https://github.com/tomusborne/generatepress/blob/b60b853630da6d9015722da903e53c8064148b0a/inc/structure/header.php#L151-L165
-
AuthorPosts
- You must be logged in to reply to this topic.