[Support request] Adding code for Amp ads into the theme Function

Home Forums Support [Support request] Adding code for Amp ads into the theme Function

Home Forums Support Adding code for Amp ads into the theme Function

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1483936
    Heath

    Is this advisable? I know this is not theme related but I’m not really sure if its a good idea or not. I dont want to mess anything up.

    #1483973
    Elvin
    Staff
    Customer Support

    Hi,

    When doing big changes with uncertainty, its best to do it on a staging site first. Also, it’d be really helpful if you have FTP access as you can just open functions.php through that when the site crashes.

    Btw, do you have any particular reason why it must be added to the functions.php file?

    If I may suggest, instead of adding things on functions.php, I believe you can simply add your code on a Hook element and just hook it to wherever you want to place the ads.

    #1484010
    Heath

    Adsense says to copy and paste the code into header of the Amp pages….I have no idea if I have amp pages. I know some posts are amp.

    Place this code once in between the head tags of your AMP site’s HTML. This script loads the relevant amp-auto-ads libraries.

    There’s a 2nd step as well.to paste code after the body tag.

    Copy and paste this code immediately after the <body> tag of the pages you want ads to appear. The placement of the code doesn’t reflect the position of the ad.

    #1484023
    Elvin
    Staff
    Customer Support

    This article will be helpful. It’s about GP Premium’s Hook elements.
    https://docs.generatepress.com/article/hooks-element-overview/

    Place this code once in between the head tags of your AMP site’s HTML. This script loads the relevant amp-auto-ads libraries.

    You can place that script inside a Hook element hooked to wp_head.

    There’s a 2nd step as well.to paste code after the body tag.

    Copy and paste this code immediately after the <body> tag of the pages you want ads to appear. The placement of the code doesn’t reflect the position of the ad.

    You can also place that script inside a Hook element hooked to wp_body_open.

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