Site logo

Archived topic

CLS issue: more than 0.25 (desktop), CLS issue: more than 0.25 (mobile)

5 replies · Started by Jinka Narayana on April 26, 2021

Viewing posts 1–6 of 6

HI,
I am getting the same error on my entire site blogvwant.com for desktop and mobile as well.
It gives 159 URLs with the same issue.
I have checked one url https://www.blogvwant.com/best-wordpress-membership-plugins/ with GTMetrix.
It shows the issue with the first para itself. Check the screenshot.
CLS

I got the same issue on my second site whatvwant.com as well. I am using GP on the second site as well.
Can you please tell me what should I do?

Hi there,

add this PHP Snippet to your site:

add_filter( 'generate_mobile_header_logo_output', function( $output ) {
    if ( ! function_exists( 'generate_menu_plus_get_defaults' ) ) {
        return $output;
    }

    $settings = wp_parse_args(
        get_option( 'generate_menu_plus_settings', array() ),
        generate_menu_plus_get_defaults()
    );

    return sprintf(
        '<div class="site-logo mobile-header-logo">
            <a href="%1$s" title="%2$s" rel="home">
                <img src="%3$s" width="192" height="60" alt="%4$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_mobile_header_logo', $settings['mobile_header_logo'] ) ),
        esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) )
    );
} );

On this line:

<img src="%3$s" width="192" height="60" alt="%4$s" />

You need to update the width and height attributes to match the original logo image size

Thanks for your help.
I have placed the code by replacing width: 270 and height: 40 which are my original logo dimensions.
Now the issue is solved.
But I could see another issue on Google page speed insights for URL https://www.blogvwant.com/scan-wordpress-website-for-malware-free/
\ for mobile.
Can you check the screenshot https://prnt.sc/126qdyb

The first one is related to your theme.
The second one might not related to your theme. If possible, can you suggest what should I do for the second issue caused for the huge CLS issue?

Hi there,

The main offender on CLS, while it looks like it's from the theme, isn't that simple to identify.

<div id="page" class="site grid-container container hfeed"> is the main container for ALL the contents of the page. That means, plugins that render HTML elements that may cause CLS can possibly go in here as well.

But to answer the issue, the main culprit for that is the embedded iframe for ads by one of your plugins. The iframe contents are loading too slow, causing the CLS. This isn't something the theme controls as its from your ads.

The other ones are minor. I think if you solve the issue w/ CLS on the ads, the rest gets solved as well.

Thanks for the help.

No problem. :D

This archived topic is closed to new replies.