Quantcast
Channel: Topic Tag: footer | WordPress.org
Viewing all articles
Browse latest Browse all 13545

Jose on "Loading jQuery & javascript in footer"

$
0
0

You actually want to use wp_enqueue_scripts instead.

You can do it with just a few changes:

function load_js_files(){
    wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), null, true );
}
add_action( 'wp_enqueue_scripts', 'load_js_files' );

That way WordPress can handle any dependencies that are required by your files. ( Which is what the array( 'jquery' ) part does. ;) And it will also load the files in sequence.


Viewing all articles
Browse latest Browse all 13545

Trending Articles