• Resolved remiCs

    (@emersong20)


    Hello,

    I need to put the following code in <body>
    <script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"</script>

    Which AMP plugin or function should I use to be able to do this?

    • This topic was modified 5 years ago by Jan Dembowski. Reason: Formatting
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    As of v1.5 you will not need to manually add this at all. You don’t currently have to add it manually in Transitional mode or Standard mode. You only need to add it in Reader mode if the iframe is not in the content. When you have an iframe outside the content in Reader mode, you currently should use this code:

    add_filter( 'amp_post_template_data', function( $data ) {
    	$data['amp_component_scripts'] = array_merge(
    		$data['amp_component_scripts'],
    		array(
    			'amp-iframe' => true,
    		)
    	);
    	return $data;
    } );

    However, this will only be needed for the next 2 weeks. After v1.5 is released, it will have no effect.

    Thread Starter remiCs

    (@emersong20)

    Hello!

    I am using the “Transition” mode, but the “amp-iframe” is not automatically inserted, see >>> https://www.montarumnegocio.com/como-revender-produtos-de-cabelo-por-catalogo/?amp

    Plugin Author Weston Ruter

    (@westonruter)

    I see no <amp-iframe> element in the page. The script will be added when the AMP component is used in the page. You can see it is added on a page which does use an iframe, like: https://www.montarumnegocio.com/como-montar-um-minimercado/?amp

    Thread Starter remiCs

    (@emersong20)

    You’re awesome!

    I appreciate a lot your support! ??

    Plugin Author Weston Ruter

    (@westonruter)

    Thank you! Please leave the plugin a review.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘I can’t put the “amp-iframe” javascript’ is closed to new replies.