Tuesday, June 4, 2024
 Popular · Latest · Hot · Upcoming
70
rated 0 times [  75] [ 5]  / answers: 1 / hits: 25303  / 10 Years ago, wed, january 28, 2015, 12:00:00

I want to add more than one external javascript files in wordpress theme, I have found code for adding one file, but I need to add more javascript files.
How can I do it?



function wpTan_scripts() {
wp_register_script('app', '/js/app.js', false);
wp_enqueue_script( 'app' );
}
add_action('wp_enqueue_scripts', 'wpTan_scripts');

More From » wordpress

 Answers
19

you can add as many scripts as you want.



function themeslug_enqueue_script() {
wp_enqueue_script( 'jquery-v-2', 'http://code.jquery.com/jquery-2.1.3.min.js', false );
wp_enqueue_script( 'mycustomJs', 'file_name.js', false );
// here you can enqueue more js / css files
}

add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_script' );

[#68066] Sunday, January 25, 2015, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
janayr

Total Points: 80
Total Questions: 80
Total Answers: 114

Location: Venezuela
Member since Sat, Aug 22, 2020
4 Years ago
janayr questions
Wed, Dec 29, 21, 00:00, 2 Years ago
Sun, Oct 31, 21, 00:00, 3 Years ago
Tue, Feb 4, 20, 00:00, 4 Years ago
;