Open ‘functions.php’ file and create a new function called foundation_scripts. This function will look quite similar to the one that was created for CSS.
(For more information click here)
In order for Foundation to work, pulling jQuery 2.2.2 is needed through function.
Add ‘enqueue_script’ in order to run jQuery on front end of the site.
However, jQuery cannot run on back end of the site as the back end is not running on 2.2.2 version and it can cause damage to some files if it does run it on higher version of jQuery. Therefore conditional statement is needed to avoid that situation – This means that if we are not in admin area, call jQuery script. To finish it off, add
Now, once the front end is open, it will run the latest version of jQuery.
Checking if jQuery is working
Open the link and full code should appear. This means that the latest version of jQuery is working.
New JS file ‘head_own.js’ has been created and JS code from the header has been copied into it.
Go to file ‘functions.php’ and link it the way that was explained earlier. Refresh the page and check result.
After changing order of JS links, the full website was working perfectly fine.