• Hello.

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

    This is the code.

    <amp-iframe
          src="https://embed.empower.net/?video=5855011e-efd8-46ab-b2f6-d6191f1ac299&player=8261f255-3039-456d-a2b4-7c8e68bb3fb7&site=30a9d67f-911c-406c-89d3-ba68ed6d7dd9&siteName=windowstechit"
          sandbox="allow-scripts allow-same-origin"
          frameborder="0"
     layout="responsive"
          height="360"
          width="640">
          <amp-img layout="fill" src="https://str.empower.net/thumbnails/5855011e-efd8-46ab-b2f6-d6191f1ac299.jpg" placeholder></amp-img>
    </amp-iframe>

    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

    Thread Starter shreen2008

    (@shreen2008)

    @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.

    <div>
    <!-- Microsoft_ATF_336x280 -->
    <ins class="adsbygoogle"
         style="display:inline-block;width:336px;height:280px"
         data-ad-client="ca-pub-6837307237823202"
         data-ad-slot="1849388891"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script><br/>
    <!-- Responsive_MTF_LinkAds_Windows -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-6837307237823202"
         data-ad-slot="6566725542"
         data-ad-format="link"
         data-full-width-responsive="true"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>

    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

    (@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

    Thread Starter shreen2008

    (@shreen2008)

    Hello.
    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)
  • The topic ‘Custom Code in AMP’ is closed to new replies.