wp_enqueue_script()
-
Hello,
I am trying to load two scripts using wp_enqueue_script(). Unfortunately only the first one loads but not the second one. Here is the code:
//Load my own jQuery function fix_noconflict() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery' , 'https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js' );} add_action( 'wp_enqueue_scripts' , 'fix_noconflict' ); //This two functions follow the same function mauricio_bootstrap_script_jquery() { //Includes bootstrap jQuery wp_register_script( 'custom-script', get_template_directory_uri().'/mauricio_bootstrap/js/bootstrap.js', array( 'jquery' ) ); //This enqueus the script wp_enqueue_script( 'custom-script' ); } // Adds the new bootstrap function to the wp_enqueue_scripts add_action( 'wp_enqueue_scripts', 'mauricio_bootstrap_script_jquery' ); function mauricio_bootstrap_script_carousel() { wp_register_script( 'myscript', get_template_directory_uri().'/mauricio_bootstrap/js/bootstrap-carousel.js', array( 'jquery' ) ); wp_enqueue_script( 'myscript' ); } add_action( 'wp_enqueue_script', 'mauricio_bootstrap_script_carousel' );
Any suggestion will be more than welcome.
Thanks,
M
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘wp_enqueue_script()’ is closed to new replies.