Support » Plugin: PDF Embedder » Re: Pdf embedder not loading jsfiles

  • I came across this issue:

    Hi, i am trying use this plugin on my wordpress site, i structured my code with timber that is a template engine builded with twig.

    The problem with your plugin it’s because i need to have wp_head and wp_footer on my single.php and page.php. But i use twig template engine to separate files, create a better code structure, and i have that functions on separate files.

    Because i have wp_head and wp_footer on separate files, your .js files are not loading on the page.

    I had exactly the same issue as I use Twig templating and load scripts in the footer of the page.

    The suggested fix from Emma on the other thread would obviously not work as the scripts weren’t even loaded in the first place so haven’t modified the jQuery prototype.

    The problem is that insert_scripts() is called before pdfemb_wp_enqueue_scripts()
    I was able to fix the issue by inserting one line of code into the plugin.
    At line 26 of core_pdf_embedder.pdf in the insert_scripts() function:


    This makes sure the scripts have been defined before they are enqueued.

    I’m not sure what PDF Embedder is doing differently but every other plugin manages to successfully embed scripts.

    The page I need help with: [log in to see the link]

  • You must be logged in to reply to this topic.