• Resolved nakita_dog

    (@nakita_dog)


    I can see how amp_post_template_head allows me to add code to the <head> and amp_post_template_footer allows me to add code to the footer.

    Is there a way to add code just after the opening tag without having to create my own template?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Custom editor but if you intend to insert javascript / json then it will get stripped.

    Alternatively I think there is a hook but I haven’t tried it (design 2)

    add_action( ‘ampforwp_before_post_content’, ‘my_funx’ );

    I have used this to insert stuff a the end of a page /post

    add_action( ‘ampforwp_after_post_content’, ‘my_funx’ );

    Here is a list of hooks

    https://ampforwp.com/list-hooks-ampforwp-plugin/

    • This reply was modified 8 years, 1 month ago by frenchomatic.
    Thread Starter nakita_dog

    (@nakita_dog)

    Thanks. It appears that I posted this in the wrong plugin support.

    Sorry about that.

    • This reply was modified 8 years, 1 month ago by nakita_dog.

    Adding action to ‘ampforwp_before_post_content’ almost does the job, the code appears under the post title.

    I’ve managed to get the code below <body> by adding action to ‘ampforwp_body_beginning’.

    It does seem to work, but I am not 100% sure I am doing it right. See the code at the bottom of http://www.plaincitylife.com/2017/09/how-to-add-amp-auto-ads-code-to.html.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi @nakita_dog
    There is indeed a hook called ampforwp_body_beginning which allows you to add after opening body tag. But we already have a GTM option, you can use that.

    Hi @homika
    For the AMP Auto ads, we already have built an option for this but that update hasn’t been released, it will be out on 7th October.

    Regards

    Thank you Ahmed. Will be waiting for the update.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    @homika

    Thanks to You for using the plugin!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Add AMP GTM after opening body tag?’ is closed to new replies.