Accessing javascript in multiple files [closed]
You have to create a dependency with wp_register_script($handle, $src, $dependency, $version, true/false); See WP codex: wp_register_script and then make sure that the second file is loaded correctly and right after the initial script. The third parameter is an array for dependencies/other “handles”. So..in your case: <?php // Functions.php or somewhere else wp_register_script(‘my_first_script’,get_template_directory_uri().’/js/my-first-script.js’, array(‘jQuery’), ‘1.0’, true); … Read more