function banana_scripts() {     
    wp_enqueue_script('grid', get_stylesheet_directory_uri() . '/js/jquery.min.js', null, null);
    wp_enqueue_script('grid', get_stylesheet_directory_uri() . '/js/main.js', null, null);
}   
add_action('wp_enqueue_scripts', 'banana_scripts');

I have the above hook in my functions.php. The first js file gets included, the second not. Is it incorrect to call this function twice or more?

1 Answer
1

You gave each each script the same handle/id of ‘grid’

Try something like this.

function banana_scripts() {     
    wp_enqueue_script('grid', get_stylesheet_directory_uri() . '/js/jquery.min.js', null,   null);
    wp_enqueue_script('grid2', get_stylesheet_directory_uri() . '/js/main.js', null, null);
}   
add_action('wp_enqueue_scripts', 'banana_scripts');

Leave a Reply

Your email address will not be published. Required fields are marked *