• Hello.

    I am trying to place “custom ad script” code inside the content of AMP pages.

    This is the code.

          sandbox="allow-scripts allow-same-origin"
          <amp-img layout="fill" src="https://str.empower.net/thumbnails/5855011e-efd8-46ab-b2f6-d6191f1ac299.jpg" placeholder></amp-img>

    But it is not working or displaying.
    Adsense Ads are working as intended.

    But if I place any custom code, it is not working .

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @shreen2008,

    I think you’ll be able to solve your issue in this way:

    1) open the file ./output/functions.php
    2) find ' . strip_tags( $custom_ad_code, '<amp-ad><amp-embed>' ) . ', ~807 row (not sure about right row number)
    3) replace with ' . strip_tags( $custom_ad_code, '<amp-ad><amp-embed><amp-iframe>' ) . '

    I hope it will help.

    Kind regards

    @daweb : Thanks it worked. Nice tip.

    I also have another problem with custom Adsense code.
    I am trying to put this code as custom code.

    <!-- Microsoft_ATF_336x280 -->
    <ins class="adsbygoogle"
    (adsbygoogle = window.adsbygoogle || []).push({});
    <!-- Responsive_MTF_LinkAds_Windows -->
    <ins class="adsbygoogle"
    (adsbygoogle = window.adsbygoogle || []).push({});

    But only the first Adsense Ad is displayed. The second one is not displaying.
    I want it to work for only non-AMP pages only. I think that option is there in the plugin. But my problem is both ads are not displaying.

    Plugin Author Magazine3


    I’m sorry, The custom code section has been a problem lately for you, I have created a ticket for this: https://github.com/ahmedkaludi/ads-for-wp/issues/278

    We will fix this up in the next update

    There have been a few updates to your plugin.
    Every update is over-writing my ./output/functions.php changes.
    You said you will fix it in next update.
    It is still not fixed and the above solution is being rewritten everytime you make a update.

    How to solve this.

    Hi shreen2008,

    We have fixed the custom code issue in our last update, please check it once and let us know if you have any issue.

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