- This topic has 5 replies, 3 voices, and was last updated 4 years, 6 months ago by
David.
-
AuthorPosts
-
April 1, 2021 at 11:37 pm #1718647
Milind
Hello there, I need help.
I was getting SVG CLS issue on my blog. I google searched about the issue and found generatepress support forum – https://generatepress.com/forums/topic/svg-causing-cls-movement/page/2/. In this discussion, “Elvin” provided a code to fix SVG causing CLS movement issue.
add_filter( 'generate_logo_output', 'tu_logo_attributes', 10, 3 ); function tu_logo_attributes( $output, $logo_url, $html_attr ) { printf( '<div class="site-logo"> <a href="%1$s" title="%2$s" rel="home"> <img width="235" height="100" /> </a> </div>', esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), $html_attr ); }
After adding this code, the problem is solved. But the problem is my site navigation was shrunk off. How to fix this?? Please help.
April 2, 2021 at 12:58 am #1718708Elvin
StaffCustomer SupportHi there,
There are multiple ways to increase the height of your site navigation.
One way is to increase the size of the logo in Appearance > Customize > Site Identity (Logo width). https://share.getcloudapp.com/OAuPx05q
The site navigation should increase in size along with it to make it fit inside it.
Another way is to increase the menu item height of your primary navigation on Appearance > Customize > Layout > Primary Navigation. https://share.getcloudapp.com/Jru4wPrE
Same principle with increasing the size of the logo.One more way of doing this is through custom CSS.
Example #1: by adding padding
nav#site-navigation { padding: 15px ; }
Example #2: By setting the min-height of the inner container
nav#site-navigation .inside-navigation.grid-container { min-height:100px; }
April 2, 2021 at 3:46 am #1718849Milind
I am using the SVG logo and as per pagespeed insight, it is showing to add width and height. Before my site logo was placed left-hand side and after adding this code.
add_filter( 'generate_logo_output', 'tu_logo_attributes', 10, 3 ); function tu_logo_attributes( $output, $logo_url, $html_attr ) { printf( '<div class="site-logo"> <a href="%1$s" title="%2$s" rel="home"> <img width="235" height="100" /> </a> </div>', esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), $html_attr ); }
It moved to the right stick with the menu. I have added my site URL under Private information kindly check.
April 2, 2021 at 4:39 am #1718886David
StaffCustomer SupportHi there,
try adding this CSS to correct the position:
.site-logo { margin-right: auto; } .site-logo img { vertical-align: bottom; } @media(max-width: 768px) { .site-logo { margin-left: 10px; } }
April 2, 2021 at 5:11 am #1718925Milind
Thanks, x 100, it worked! Great support as always.
April 2, 2021 at 5:30 am #1718942David
StaffCustomer SupportGlad to hear that!
-
AuthorPosts
- You must be logged in to reply to this topic.