I am currently rewriting an HTML template into a WordPress theme. It has a lot of code dependencies, and I’m wondering if this is the proper, most efficient way to add it. This code is listed in my functions.php file.
//Load Javascript
if (!is_admin()) add_action("wp_enqueue_scripts", "my_scripts");
function my_scripts() {
wp_register_script('easytabs', get_template_directory_uri() . '/js/jquery.easytabs.min.js', array('jquery'), null, true);
wp_register_script('respond', get_template_directory_uri() . '/js/respond.min.js', false, null, true);
wp_register_script('adipoli', get_template_directory_uri() . '/js/jquery.adipoli.min.js', array('jquery'), null, true);
wp_register_script('fancybox', get_template_directory_uri() . '/js/jquery.fancybox-1.3.4.pack.js', array('jquery'), null, true);
wp_register_script('isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js', array('jquery'), null, true);
wp_register_script('gmaps_google', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://maps.google.com/maps/api/js?sensor=false", false, null, true);
wp_register_script('gmap', get_template_directory_uri() . '/js/jquery.gmap.min.js', array('gmaps_google'), null, true);
wp_register_script('custom', get_template_directory_uri() . '/js/custom.js', array('gmap'), null, true);
wp_enqueue_script('jquery');
wp_enqueue_script('easytabs');
wp_enqueue_script('respond');
wp_enqueue_script('adipoli');
wp_enqueue_script('fancybox');
wp_enqueue_script('isotope');
wp_enqueue_script('gmaps_google');
wp_enqueue_script('gmap');
wp_enqueue_script('custom');
}