0

I am trying to load a HTML5 Audio player in a popup but am having no luck. The staging site is here

The audio player works but not after you click the Listen In Pop Up button/link. Here is my code to call the template file which contains the same code as the on page audio section.

<a class="popup" href="<?php echo get_template_directory_uri(); ?>/assets/inc/modules/module-audio-popup.php" 
onclick="javascript:void window.open('<?php echo get_template_directory_uri(); ?>/assets/inc/modules/module-audio-popup.php',
'1418242983717','width=500,height=300,toolbar=0,menubar=0,location=0,status=0,scrollbars=0,resizable=1,left=0,top=0');
return false;">
Listen in PopUp 
<span aria-hidden="true" data-icon="j"></span>
</a>

Any advice would be most welcome.

Code for the popup file here

0

There is a fatal error in your source (module-audio-popup.php) :

Fatal error: Call to undefined function the_field() in /home/website/public_html/sites/fm/wp-content/themes/trickstarfm/assets/inc/modules/module-audio-popup.php on line 11

I will remove this answer later on, but posting this as a comment wouldn't make a readable post.

  • Yes; It appears that my custom meta field/s aren't working, my custom meta fields are via the Advanced Custom Fields plugin. This particular field is the src for the mp3 file. I am unsure how to fix this? – Huw Rowlands Dec 15 '14 at 10:32
  • I suppose you didn't bootstrap WordPress in your custom PHP file...? – tfrommen Dec 15 '14 at 10:39
  • How would I go about doing that? – Huw Rowlands Dec 15 '14 at 11:39
0

I got my answer here with this snippet:

if(!defined(ABSPATH)){
    $pagePath = explode('/wp-content/', dirname(__FILE__));
    include_once(str_replace('wp-content/' , '', $pagePath[0] . '/wp-load.php'));
}

I included this before any other HTML/PHP.

0

the_field() function need a field name parameter and it must inside a loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.