Answer the question
In order to leave comments, you need to log in
How to move jquery script to footer in Wordpress?
Guys, help! I move jquery to the footer from the header:
add_action( 'wp_enqueue_scripts', 'jquery_register' );
function jquery_register() {
wp_deregister_script('jquery-core');
wp_deregister_script('jquery');
wp_register_script( 'jquery-core', 'https://code.jquery.com/jquery-2.2.0.min.js', false, null,true );
wp_register_script( 'jquery', false, array('jquery-core'), null, true );
wp_enqueue_script( 'jquery' );
}
function main_scripts() {
wp_enqueue_script( 'scripts-js', get_stylesheet_directory_uri() . '/assets/js/scripts-js.min.js', array('jquery'), true );
wp_enqueue_script( 'scripts-ini', get_stylesheet_directory_uri() . '/assets/js/scripts-ini.min.js', array('scripts-ini'), true );
}
add_action( 'wp_enqueue_scripts', 'main_scripts' );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question