I'm working on a custom theme in which it uses a custom script loaded like so in the functions.php file:
function custom_scripts_method()
{
wp_register_script('custom_script', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0.0', true);
wp_enqueue_script('custom_script');
}
add_action('wp_enqueue_scripts', 'custom_scripts_method');
I need jQuery to get it to run properly, I tried to enqueue the already existing jQuery with:
function theme_scripts() {
wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'theme_scripts');
As answered in this question here: Is jQuery included in WordPress by default?
However, this does nothing. So I added my own jQuery like so:
function jquery_scripts_method()
{
wp_register_script('jquery_script', get_template_directory_uri() . '/js/jquery.min.js', array('jquery'), '3.3.1', true);
wp_enqueue_script('jquery_script');
}
add_action('wp_enqueue_scripts', 'jquery_scripts_method');
That worked, but then it also loaded the already existing jQuery along with it. So now there are two files being called, version 1.12 and 3.3.
How do I just get the one that is already there to load?