Title: Insert code to all
Last modified: January 11, 2019

---

# Insert code to all

 *  [kghugo2000](https://wordpress.org/support/users/kghugo2000/)
 * (@kghugo2000)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/)
 * Dear developers,
 * Is there a way for me to insert a html code to all post?
 * I have tested the following code works in the AMP page builder, but I want to
   add it to all post instead of just a single one.
 * <iframe data-v-b66e9a5a=”” src=”[https://button.like.co/in/embed/howtostudycantonese/button?referrer=https://www.howtostudycantonese.com/u8l9-particle%EF%BC%88%E5%98%85%EF%BC%89/&type=wp&#8221](https://button.like.co/in/embed/howtostudycantonese/button?referrer=https://www.howtostudycantonese.com/u8l9-particle%EF%BC%88%E5%98%85%EF%BC%89/&type=wp&#8221);
   frameborder=”0″ class=”lc-margin-top-64 lc-margin-bottom-32 lc-mobile”></iframe
   >
 * Thank you for reading.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finsert-code-to-all%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Mohammed Kaleem](https://wordpress.org/support/users/beingsmart/)
 * (@beingsmart)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11076522)
 * Hi [@kghugo2000](https://wordpress.org/support/users/kghugo2000/)
 *  I would like to inform you that, In the Widget section of WordPress you’ll find
   the AMP Widgets Sitewide from there you can load the iframe on whole AMP version.
 *  Thread Starter [kghugo2000](https://wordpress.org/support/users/kghugo2000/)
 * (@kghugo2000)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11076916)
 * Dear developers,
 * Thank you for your help. But if I insert those code as an widget in AMP above
   footer slot, it will appear after the Related Posts. Is is possible for me to
   insert in right after my content?
 * Thank you for reading.
 *  [AbdulAzeem](https://wordpress.org/support/users/abdulazeem/)
 * (@abdulazeem)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11080984)
 * Hi [@kghugo2000](https://wordpress.org/support/users/kghugo2000/),
 * I’m attaching the code to insert the HTML after the content. Please add this 
   code to your theme > functions.php file. Here is the code:
 *     ```
       add_action('pre_amp_render_post','ampforwp_insert_html_content');
       function ampforwp_insert_html_content(){
   
           add_filter( 'the_content', 'ampforwp_insert_html_code' );
       }
       function ampforwp_insert_html_code($content){
           $iframe = '<iframe data-v-b66e9a5a="" src="https://button.like.co/in/embed/howtostudycantonese/button?referrer=https%3A%2F%2Fwww.howtostudycantonese.com%2Fu8l9-particle%EF%BC%88%E5%98%85%EF%BC%89%2F&type=wp" frameborder="0" class="lc-margin-top-64 lc-margin-bottom-32 lc-mobile"></iframe>';
           $content = $content . $iframe;
           return $content;
       }
       ```
   
 * Hope it helps, if you have any queries feel free to ask.
 *  Thread Starter [kghugo2000](https://wordpress.org/support/users/kghugo2000/)
 * (@kghugo2000)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11081176)
 * Thank you so much!
 * This code works perfectly well! But the only problem is that, a specific URL 
   is used in that code(representing my post). Just want to know that is it possible
   to make that URL as a variable that would change when it is being displayed in
   different posts?
 * Thank you for reading and I really appreciate your help.
 *  Plugin Contributor [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * (@ampforwp)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11085504)
 * [@kghugo2000](https://wordpress.org/support/users/kghugo2000/)
 * I didn’t get your question. Could you please elaborate in more detail with an
   example? So that I can understand the use-case scenario and help you.
 *  Thread Starter [kghugo2000](https://wordpress.org/support/users/kghugo2000/)
 * (@kghugo2000)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11091363)
 * Sure. In my code, a url is used for a specific page.
 * <iframe data-v-b66e9a5a=”” src=”https://button.like.co/in/embed/howtostudycantonese/
   button?referrer=**[https://www.howtostudycantonese.com/u8l9-particle%EF%BC%88%E5%98%85%EF%BC%89/](https://www.howtostudycantonese.com/u8l9-particle%EF%BC%88%E5%98%85%EF%BC%89/)**&
   type=wp” frameborder=”0″ class=”lc-margin-top-64 lc-margin-bottom-32 lc-mobile”
   ></iframe>
 * It is possible to make an add to all that this URL will also change accordingly?
 * Thank you for your help and your support.
 *  Plugin Contributor [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * (@ampforwp)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11103150)
 * Yes, it’s possible to add the URL in the $iframe and it will change accordingly.
 * Hope it helps.
 *  Thread Starter [kghugo2000](https://wordpress.org/support/users/kghugo2000/)
 * (@kghugo2000)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11103716)
 * Ah I see thank you so much. Is it possible for you write it for me as an extra?
   I will be glad to pay for it.
 * Thank you so much for your help and your effort in running such a great plugin.
 *  Plugin Contributor [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * (@ampforwp)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11111476)
 * Hi [@kghugo2000](https://wordpress.org/support/users/kghugo2000/),
 * Please contact us directly to on [team@magazine3.com](https://wordpress.org/support/topic/insert-code-to-all/team@magazine3.com?output_format=md),
   Our lead developers will help you there.
 * And also please mention this forum thread.
 * Thank you.

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

The topic ‘Insert code to all’ is closed to new replies.

 * ![](https://ps.w.org/accelerated-mobile-pages/assets/icon-256x256.png?rev=1693616)
 * [AMP for WP - Accelerated Mobile Pages](https://wordpress.org/plugins/accelerated-mobile-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/accelerated-mobile-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/accelerated-mobile-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/accelerated-mobile-pages/reviews/)

 * 9 replies
 * 4 participants
 * Last reply from: [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/insert-code-to-all/#post-11111476)
 * Status: not resolved