JavaScript not working in exported Foundation WordPress theme

When my Wordpress theme is exported, the JS functionality for Foundation drop downs and modals stops working. It all works fine in Pinegrow before export. I have tried to work out whether files are missing/misplaced or whether it is a code error, but to no avail.

(I am not having the same problems.with Bootstrap)

Hello @crimmins,

Initializing Foundation with WordPress is a bit more touchy than with Bootstrap and the web is full of people facing the same issue and asking the question :slight_smile:

Here is an easy solution for you,

From your master page, you have the Foundation init included at the bottom of the document


Put this script in an external file in your project folder (for example, create fdinit.js and put it in the js folder)

Then, replace the inline script with the call to the external JS file right after the foundation.js initialization.

Export your theme, from your browser, open the Inspector, have a look at the console. There should be no error message and the Foundation features should work fine.


Thank you for your prompt response.
Much appreciated and very helpful,
Charles Crimmins

What a clever workaround, we had to do this so much in the old days. I don’t miss it though!