JavaScripts

We discontinue development of the required+ Foundation theme – here is why.×

Let’s have a look at the JavaScripts used in required+ Foundation and where you should put your custom code so it all works smoothly.


WordPress JavaScript

Many plugins and a lot of WordPress functionality depend on the fantastic jQuery library. Unfortunately some features and some plugins need jQuery to be loaded in the head. In the parent theme the file includes/req-scripts.php handles the script management for you. By default we load the following scripts:

  • foundation-js required-foundation.min.js custom foundation.min.js, depends on jQuery
  • app-js app.js Foundation code, depends on foundation-js
  • theme-js theme.js parent theme JavaScript, depends on foundation-js and app-js
  • offcanvas-js jquery.offcanvas.js off canvas page template, depends on foundaion-js
  • comment-reply comment-reply.js used for threaded comments, WordPress JavaScript

Foundation JavaScript

Foundation comes with custom jQuery plugins packed in the foundation.min.js. This file has the jQuery library included by default, we strip it out in our required-foundation.min.js because we use the jQuery version packed with WordPress, to ensure compatibility with most plugins.


JavaScript in your child theme

This is were it gets interesting for you. In your child theme there is a file javascripts/child-theme.js, it’s empty by default and gets registered as child-theme-js and loaded in the child theme functions.php. All your custom JavaScript code is supposed to go in this file. Let’s have a look at how you’ll add your code:

/**
 * Here goes all the JS Code you need in your child theme buddy!
 */
(function($) {
    // here goes your custom code
}(jQuery));

Shortcodes

Have a look at the optional shortcode plugins we built for required+ Foundation and how to use them in your next theme.

Shortcodes »