Archived topic
Theme seller - cls issue on the front page
13 replies · Started by Jean on October 14, 2021
Hello,
I use theme seller
The cls is always around 0,2 ont the main page for mobile.
I've tried everything I know. It doesn't work.
Could you please give me any advice ?
Thank you.
Jean
Hi there,
try adding the following PHP Snippet to your site:
add_action( 'after_setup_theme', function() {
remove_action( 'wp_head', 'generate_add_viewport' );
add_action( 'wp_head', 'generate_add_viewport', 1 );
} );
This doc explains how to add PHP: https://docs.generatepress.com/article/adding-php/
Thank you David.
the snippet has improved the cls but it is still above 0.1.
Have you, plesae, any other solution ?
Thnak you
Very odd - you images are loading with width and height attributes so the browser should reserve space for them... but its not. What method are you using to load WebP images on the site? I wonder if that is interfering.
Not sure my answer fits the question...
I downloaded them in the media library. I don't use any cdn.
Hmmm... this is very odd, theres no reason why those images shouldn't load correctly.
As a note though - not all browsers support webP - which means they won't display on them.
I wonder if the WP lazy loading feature is affecting them. You cant try adding this additional PHP Snippet to disable that:
add_filter( 'wp_lazy_loading_enabled', '__return_false' );
Thank you David.
There's no significative improvment with the snippet.
I'll test with jpeg and come back.
Let us know :)
I tried jpeg images. It doesn't change anything.
Can you try removing this CSS:
.woocommerce ul.products li.product a img, .woocommerce div.product div.images img {
padding: 3px;
border: 1px solid rgba(0,0,0,0.1);
box-sizing: border-box;
}
Thank you David.
The borders were the culprits
It's far better now.
I very appreciate your help !
Thank you very much.
Have a nice day.
Sorry i should have spotted that before!
Glad to be of help.
Don't be sorry David !
I found another thing that improves the cls. I preload the two first images of products
Thank you for your help.
Thats great to hear :)