# JavaScript not working in exported Foundation WordPress theme

**URL:** https://forum.pinegrow.com/t/javascript-not-working-in-exported-foundation-wordpress-theme/1906
**Category:** Foundation
**Tags:** bug
**Created:** [May 21, 2018, 2:52am UTC](https://forum.pinegrow.com/t/javascript-not-working-in-exported-foundation-wordpress-theme/1906 "2018-05-21T02:52:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![crimmins](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/crimmins/32/2418_2.png) [@crimmins](https://forum.pinegrow.com/u/crimmins)
#### Post date: [May 21, 2018, 2:52am UTC](https://forum.pinegrow.com/t/javascript-not-working-in-exported-foundation-wordpress-theme/1906/1 "2018-05-21T02:52:39Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![Emmanuel](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/emmanuel/32/6294_2.png) [@Emmanuel](https://forum.pinegrow.com/u/Emmanuel)
#### Post date: [May 22, 2018, 12:15pm UTC](https://forum.pinegrow.com/t/javascript-not-working-in-exported-foundation-wordpress-theme/1906/2 "2018-05-22T12:15:33Z")

</div>

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 🙂

Here is an easy solution for you,

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

 ![fdinit001](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/0/0b4cb7ceb11daf087425401308cbe74200980ef1.jpg)

`$(document).foundation();`

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

 ![fdinit002](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/d/d7eb99f61291dbfa9932d0ff5fad6d493e41830d.jpg)

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

 ![fdinit003](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/1/1c4fe47c285a9cab5990fbe8b18ec6d40e57fcec.jpg)

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.

Cheers.

---

<div class="post-metadata">

### Author: ![crimmins](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/crimmins/32/2418_2.png) [@crimmins](https://forum.pinegrow.com/u/crimmins)
#### Post date: [May 22, 2018, 12:50pm UTC](https://forum.pinegrow.com/t/javascript-not-working-in-exported-foundation-wordpress-theme/1906/3 "2018-05-22T12:50:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![texxsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/texxsmith/32/1201_2.png) [@texxsmith](https://forum.pinegrow.com/u/texxsmith)
#### Post date: [May 22, 2018, 1:26pm UTC](https://forum.pinegrow.com/t/javascript-not-working-in-exported-foundation-wordpress-theme/1906/4 "2018-05-22T13:26:36Z")

</div>

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