[Support request] Remove Adsense from homepage

Home Forums Support [Support request] Remove Adsense from homepage

Home Forums Support Remove Adsense from homepage

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #633127
    Charlie

    Hi guys,

    First thanks for all the hard work, your theme rocks.

    So I have been searching freaking everywhere but I cannot seem to find a solution to my problem. I am not really coding savy either so it doesn’t help.

    So basically,I have a top bar add on my site with adsense. I just want to remove it from my home page. It’s fine to appear when clicking on categories and Co but I just want it removed from my homepage. Is there a way to do this easily?

    Thanks.

    #633132
    David
    Staff
    Customer Support

    Hi there,

    if you’re using GP Hooks to add the adsense code then you can wrap it in a conditional tag:

    https://docs.generatepress.com/article/using-hooks-conditional-tags/

    #633372
    Charlie

    Hi!

    I have tipped this :

    <?php if ( ! is_front_page() ) : ?>
    <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <!– adsense top –>
    <ins class=”adsbygoogle”
    style=”display:inline-block;width:970px;height:90px”
    data-ad-client=”ca-pub-3584266708275304″
    data-ad-slot=”3354257043″></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>

    <?php endif; ?>

    But it doesn’t work, the add is still up, is there anything I am doing wrong?

    #633400
    David
    Staff
    Customer Support

    The code looks fine. Have you tried clearing any plugin / server caches?

    #634436
    Charlie

    I did but I am still experiencing the same issue.

    #634591
    David
    Staff
    Customer Support

    In the hook have you checked Execute PHP ?

    #691355
    Charlie

    Thanks David! Really late answer I know but I did not check the PHP button!

    #691356
    David
    Staff
    Customer Support

    Glad to hear you got it resolved 🙂

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