[Support request] the site header is weird spreading in mobile devices.

Home Forums Support the site header is weird spreading in mobile devices.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1056531
    Immi

    Hi, My site header is weird spreading in mobile devices after implement Google Adsense code in WP_head hook.
    I have attached screenshots of the issues where I seeing the spreader site header and also where I have placed the code at WP_head hook.

    Please help me how to fix this issue.

    Capture.JPG
    google code.JPG

    #1057108
    Leo
    Staff
    Customer Support

    Hi there,

    David and I both checked your site and we are not seeing the issue.

    I’ve tried incognito mode so no Adblock is added.

    Have you solved this?

    Do you have another device to check?

    Let me know 🙂

    #1057147
    Immi

    Yes, I have checked on multiple devices but facing the same issue on multiple mobile devices. If I remove google Adsense code from WP_head hook problem is solved.

    as Mr David say here WP_head hook can be selected to add code into the header.
    https://generatepress.com/forums/topic/how-to-remove-white-space-below-the-site-header/#post-1053993

    I have removed the code from Theme editor after Mr David say and placed the code on GP Hook Element. After implementing Google Adsense code in WP_head hook my site header spread or showing google ads with spreading header. Which is looking weird.

    ads.jpg
    aa.jpg

    #1057419
    Tom
    Lead Developer
    Lead Developer

    What code are you adding in wp_head, exactly? It looks like the empty space is being added by the ad itself.

    #1057506
    Immi

    Yes, Tom, empty space is displaying by the ad in site header for mobile devices only. I have added Google Adsense Auto ad code in WP_head hook like this.

    <script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt;
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: “ca-pub-7341502470185310″,
    enable_page_level_ads: true
    });
    </script>

    <script data-ad-client=”ca-pub-7341502470185310″ async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt;

    #1058001
    Tom
    Lead Developer
    Lead Developer

    What if you add that code where you want the ad to show up instead of in the wp_head area?

    #1058030
    Immi

    Hi, Tom, I put that code in the wp_head area because it is Google Adsense Verification Code and Auto ad code. And google also says paste it between the <head> and </head> tags of your site:

    I don’t want to display ad in the header area as showing empty space is being added by the ad itself.

    Can you suggest me a place where I add Google Adsense Verification Code and Auto ad code? without facing such as issues.

    adsense.JPG

    #1058188
    Tom
    Lead Developer
    Lead Developer

    Maybe the auto ads are just placing the ad in a poor position? Have you tried adding manual ads?

    #1058277
    Immi

    Okay, I have removed the Auto ad code from wp_head, and I will try to add manual ads after Google Adsense Verification Code successfully implement. But the question is, where should I add this Google Adsense verification code before this?

    If I use the hook element and add Adsense Verification code inside WP_Head, the problem is that a blank ad space appears in the header of the site, which appears on mobile devices and looks very bad.

    I have also tried Insert Headers and Footers plugin for adding Adsense Verification code. And also placed this code in appearance>Theme editor> header.php between the <head> and </head> tags. But, unfortunately, facing the same issue.

    #1058818
    Tom
    Lead Developer
    Lead Developer

    If it’s just a verification code, it shouldn’t cause any space, as it shouldn’t render anything. Only the Adsense code that renders an ad should create a space in the HTML. If that code is placed where you want the ad, it should work.

    Placing something in the <head> tags is the same as using wp_head.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.