Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi @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

    (@kghugo2000)

    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.

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

    (@kghugo2000)

    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

    (@ampforwp)

    @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

    (@kghugo2000)

    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/&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

    (@ampforwp)

    Yes, it’s possible to add the URL in the $iframe and it will change accordingly.

    Hope it helps.

    Thread Starter kghugo2000

    (@kghugo2000)

    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

    (@ampforwp)

    Hi @kghugo2000,

    Please contact us directly to on [email protected], 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.