• Resolved Paul Ryan

    (@figureone)


    Aloha @pavex,

    We were having difficulty getting albums embedded via shortcode to work unless we manually added the script tag for pa-embed-player.min.js to the page content.

    I determined this was because the plugin enqueues the javascript in the html <head>, which means it is loaded before the DOM is created, so it doesn’t find any div.pa-embed-player elements to render.

    The fix is simple: use the 5th param to wp_enqueue_scripts to load the script in the footer, so it executes after the DOM is loaded.
    https://developer.www.ads-software.com/reference/functions/wp_enqueue_script/

    In your source, change line 92 of pavex-embed-google-photos-album.php to:
    wp_enqueue_script(self::$name, $this->player_js, array(), false, true);

    Thanks for the excellent plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Enqueue script in footer’ is closed to new replies.