Title: New Issues
Last modified: September 1, 2016

---

# New Issues

 *  [harryshawk](https://wordpress.org/support/users/harryshawk/)
 * (@harryshawk)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/new-issues/)
 * New Issues
 * Background:
    My site is a podcast.. and so there should be an audio player on
   each page. The player is visible as part of the standard page.
 * LibSyn and Bluebrry (PowerPress) are the largest hosts for podcasters; I have
   3 diff. audio players.
 * Issue #1a
    This page has the audio player from Blubrry/Powerpress: [http://www.draggedy.com/2016/07/anuj-vaidya-dragging-species-and-nationality/](http://www.draggedy.com/2016/07/anuj-vaidya-dragging-species-and-nationality/)
 * Issue #1b
    This page has an audio player from LibSyn plus an episode player: 
   [http://www.draggedy.com/2016/06/talking-with-villinda-vile-horror-entertainer-episode-3/](http://www.draggedy.com/2016/06/talking-with-villinda-vile-horror-entertainer-episode-3/)
 * **In both cases the audio player isn’t showing** but the episode player is. I’m
   getting different results on Desktop and Android Mobile when using ?amp
 * Issue #2
    This maybe related or not, I am getting AMP errors for these two pages.
   I didn’t try others on my site. This will link [to screen shots](http://imgur.com/a/SUdWU)
 * I wasn’t able to tell this earlier as I wasn’t seeing the whole page previously(#
   1a). The previous vers. may not have had this issues (#1b)
 * Harry
 * PS is there a better way to send you screen shots?
 * [https://wordpress.org/plugins/accelerated-mobile-pages/](https://wordpress.org/plugins/accelerated-mobile-pages/)

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

 *  [mcfreder](https://wordpress.org/support/users/mcfreder/)
 * (@mcfreder)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/new-issues/#post-7676716)
 * In the plugin folder:
 * > wp-content\plugins\accelerated-mobile-pages\themes\default
 * Open up header.php and underneath <head> add the following script:
 * `<script async custom-element="amp-audio" src="https://cdn.ampproject.org/v0/
   amp-audio-0.1.js"></script>`
 * Open up functions.php and add this code under // Strip the styles:
 *     ```
       // amp_audio https://www.ampproject.org/docs/reference/extended/amp-audio.html
       function amp_audio($content) {
       $src2 = preg_match('/<audio\b[^>]*>(.*?)<\/audio>/is', $content, $resultz);
       preg_match('/<source(.*)src(.*)=(.*)"(.*)"/U', $resultz[1], $result);
       $amp_audio = array_pop($result);
       $amp_audio = str_replace("?_=1", "", $amp_audio);
       $replace = '<amp-audio width="400" height="300" src="'."$amp_audio".'">
       <div fallback>
        <p>Your browser doesn’t support HTML5 audio</p>
       </div>
         <source type="audio/mpeg" src="foo.mp3">
         <source type="audio/ogg" src="foo.ogg">
       </amp-audio>';
   
       $content = preg_replace('#<audio .*?>(.*?)</audio>#i', $replace, $content);
           return $content;
       }
       add_filter('the_content','amp_audio', 20 );
       ```
   
 * This code will automatically solve Issue #1a (this code should replace any audio
   player that has <audio></audio> tag with the amp friendly tag: [https://www.ampproject.org/docs/reference/extended/amp-audio.html](https://www.ampproject.org/docs/reference/extended/amp-audio.html)
 * Concerning Issue #1b
 * In the same file “functions.php” look for :
 *     ```
       // amp_iframe_tag will convert all the iframe tags and will change it to amp-iframe to make it AMP compatible.
       function amp_iframe_tag($content) {
           $replace = array (
               '<iframe' => '<amp-iframe',
               '</iframe>' => '</amp-iframe>'
           );
           $content = strtr($content, $replace);
           return $content;
       }
       add_filter('the_content','amp_iframe_tag', 20 );
       ```
   
 * replace it with:
 *     ```
       // amp_iframe https://www.ampproject.org/docs/reference/extended/amp-iframe.html
       function amp_iframe($content) {
       $amp_iframe = preg_match( '#<iframe .*?>(.*?)#i', $content, $matchery );
       $amp_iframe = preg_match( '@src="([^"]+)"@' , $matchery[0], $matcher );
   
       $replace = '<amp-iframe width=300 height=300
           sandbox="allow-scripts allow-same-origin"
           layout="responsive"
           frameborder="0"
           src="'."$matcher[1]".'">
       </amp-iframe>';
       $content = preg_replace('#<iframe .*?>(.*?)</iframe>#i', $replace, $content);
           return $content;
       }
       add_filter('the_content','amp_iframe', 20 );
       ```
   
 * and don’t forget to also add this script to the header.php under <head>:
 * `<script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/
   amp-iframe-0.1.js"></script>`
 *  Thread Starter [harryshawk](https://wordpress.org/support/users/harryshawk/)
 * (@harryshawk)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/new-issues/#post-7676783)
 * Thanks
 *  Plugin Author [Ahmed Kaludi](https://wordpress.org/support/users/ahmedkaludi/)
 * (@ahmedkaludi)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/new-issues/#post-7676801)
 * Hey [@mcfreder](https://wordpress.org/support/users/mcfreder/)
 * Thank you for the awesome reply! I really appreciate that you are helping Harry!
 * We will be adding the Audio support in the next week’s update!
 * Regards,
    Ahmed
 *  Thread Starter [harryshawk](https://wordpress.org/support/users/harryshawk/)
 * (@harryshawk)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/new-issues/#post-7676820)
 * Ahmed, if I wait until next week would I still have to make some or all of the
   changes manually.. is it worth waiting 🙂
 * Thanks
 *  [mcfreder](https://wordpress.org/support/users/mcfreder/)
 * (@mcfreder)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/new-issues/#post-7676834)
 * You are welcome guys! I made youtube/flash object video stripping tag to amp 
   friendly if you would like me to share it too.
 *  Plugin Author [Ahmed Kaludi](https://wordpress.org/support/users/ahmedkaludi/)
 * (@ahmedkaludi)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/new-issues/#post-7676871)
 * [@mcfreder](https://wordpress.org/support/users/mcfreder/) Sure, I’d love to 
   look at the code. Anything that improves is good.
 * Thanks,

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

The topic ‘New Issues’ 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/)

## Tags

 * [amp errors](https://wordpress.org/support/topic-tag/amp-errors/)

 * 6 replies
 * 3 participants
 * Last reply from: [Ahmed Kaludi](https://wordpress.org/support/users/ahmedkaludi/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/new-issues/#post-7676871)
 * Status: not resolved