My theme uses this function to load Javascript and CSS
function aitEnqueueScriptsAndStyles()
{
// just shortcuts
$s = THEME_CSS_URL;
$j = THEME_JS_URL;
aitAddStyles(array(
'ait-jquery-prettyPhoto' => array('file' => "$s/prettyPhoto.css"),
'ait-jquery-fancybox' => array('file' => "$s/fancybox/jquery.fancybox-1.3.4.css"),
'ait-jquery-hover-zoom' => array('file' => "$s/hoverZoom.css"),
'ait-jquery-fancycheckbox'=> array('file' => "$s/jquery.fancycheckbox.min.css"),
'jquery-ui-css' => array('file' => "$s/jquery-ui-1.10.1.custom.min.css"),
));
aitAddScripts(array(
'jquery-ui-tabs' => true,
'jquery-ui-accordion' => true,
'jquery-ui-autocomplete' => true,
'jquery-ui-slider' => true,
'ait-jquery-fancycheckbox' => array('file' => "$j/libs/jquery.fancycheckbox.min.js", 'deps' => array('jquery')),
'ait-jquery-html5placeholder' => array('file' => "$j/libs/jquery.simpleplaceholder.js", 'deps' => array('jquery')),
'ait-googlemaps-api' => array('file' => 'http://maps.google.com/maps/api/js?sensor=false&language=en', 'deps' => array('jquery')),
'ait-jquery-gmap3-label' => array('file' => "$j/libs/gmap3.infobox.js", 'deps' => array('jquery')),
'ait-jquery-gmap3' => array('file' => "$j/libs/gmap3.min.js", 'deps' => array('jquery')),
'ait-jquery-infieldlabel' => array('file' => "$j/libs/jquery.infieldlabel.js", 'deps' => array('jquery')),
'ait-jquery-prettyPhoto' => array('file' => "$j/libs/jquery.prettyPhoto.js", 'deps' => array('jquery')),
'ait-jquery-fancybox' => array('file' => "$j/libs/jquery.fancybox-1.3.4.js", 'deps' => array('jquery')),
'ait-jquery-easing' => array('file' => "$j/libs/jquery.easing-1.3.min.js", 'deps' => array('jquery')),
'ait-jquery-nicescroll' => array('file' => "$j/libs/jquery.nicescroll.min.js", 'deps' => array('jquery')),
'ait-jquery-quicksand' => array('file' => "$j/libs/jquery.quicksand.js", 'deps' => array('jquery')),
'ait-jquery-hover-zoom' => array('file' => "$j/libs/hover.zoom.js", 'deps' => array('jquery')),
'ait-jquery-finished-typing' => array('file' => "$j/libs/jquery.finishedTyping.js", 'deps' => array('jquery')),
'ait-jquery-jcarousel' => array('file' => "$j/libs/jquery.jcarousel.min.js", 'deps' => array('jquery')),
'ait-spin-ajax-loader' => array('file' => "$j/libs/spin.min.js"),
'ait-modernizr-touch' => array('file' => "$j/libs/modernizr.touch.js"),
'ait-gridgallery' => array('file' => "$j/gridgallery.js", 'deps' => array('jquery')),
'ait-rating' => array('file' => "$j/rating.js", 'deps' => array('jquery')),
'ait-script' => array('file' => "$j/script.js", 'deps' => array('jquery')),
));
wp_localize_script( 'ait-script', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'ajaxnonce' => wp_create_nonce('ajax-nonce') ) );
}
add_action('wp_enqueue_scripts', 'aitEnqueueScriptsAndStyles');
I am using a child theme and I was wondering how can I load additional Javascript in the functions.php inside the child theme.
The reason for using this is that any changes i make to the code above will be overwritten in the next update.