Site logo

Archived topic

Cumulative Layout Shift (Issue)

12 replies · Started by Anil kumar on December 29, 2022

Viewing posts 1–13 of 13

When I have placed ads below the entry title, then I am facing the problem of Cumulative Layout Shift.

Image link

website link

Hi there,

From my understanding, ads often cause CLS issues and it's not something the theme can control.

We could try to reserve the space for ads with CSS, but then users who use a browser app like AdBlock will see a big empty space.

please provide any css code for reserve the space for ads.

I have pasted the code in css but how to paste html code and where. because i am using ad-inserter.

because i am using ad-inserter.

In that case, you would need to check with Ad Inserter's support team.

no other suggestions?

Hello David, please tell me what to do. please provide any css code for reserve the space for ads.

Thanks Fernando, problem solved. but I want to show this ads only mobile version. please help.

Can you change the Hook Element code to this?:

<?php

if(wp_is_mobile()) { ?>
<div class="header-advert-wrap">
// Your Ad script goes here
</div>

<?php } ?>

Make sure to add your ad script.

Make sure to check "Enable PHP" in the Hook Element settings as well.

After entering the code, the ad is not visible in the desktop but the desktop space is still being created in Core Vital. Because of which Largest Contentful Paint issue is coming.

photo (Largest Contentful Paint)

This archived topic is closed to new replies.