Support » Plugin: AMP » Easy way to convert an image into AMP ?

  • Resolved davidhorizon



    I have custom fields with image. Is there an easy way to convert images html markup into amp ?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Weston Ruter


    If using the new AMP theme support, then you just output an img tag as you would do normally, and the plugin will convert it to an amp-img automatically. See

    Otherwise, you’ll need to take a similar approach suggested for adding ACF support to the legacy templates:

    Thread Starter davidhorizon



    thank you. I made a quick and dirty function based on your answer

    * AMPize : Convert html to AMP	
    function ampize($regular_html)
    	$amp_content = new AMP_Content(
    		amp_get_content_embed_handlers( get_post() ),
    		amp_get_content_sanitizers( get_post() )
    	return $amp_content->get_amp_content();					

    To me first answer convert every template and prevent my own amp template to work. I duplicated amp files in plugin folder to create my own template maybe that’s why.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Easy way to convert an image into AMP ?’ is closed to new replies.