Hello Enfold Team!
I want to add in the <head> some jquery script and I get some issue with that.
I tried to add this function in my child theme functions.php :
<?php
function add_customjs() {
wp_enqueue_script( ‘customjqueryscript’, get_stylesheet_directory_uri().’/custom.js/jquery-1.11.2.min.js’, array(‘jquery’), 2, true );
}
add_action( ‘wp_enqueue_scripts’, ‘add_customjs’, 100 );
?>
The file ‘jquery-1.11.2.min.js’ is located in the custom.js folder in my child theme.
After that I clean the cache of my browser and reload the page and see if it’s added in the <head>. And it’s pretty added but the effect wich I need don’t work…
But when I add this code :
<script src=”http://site_name/wp-content/themes/enfold/js/custom-js/jquery-1.11.2.min.js”></script>
( I created custom-js folder in the js folder and put the file )
or
<script src=”https://code.jquery.com/jquery-1.11.2.min.js”></script>
In the “Scripts in Header” section of the plugin “Insert Headers and Footers”, both working well..
In case, I don’t want to use this plugin to add the jquery script in the head.
Can you help me to solve the problem
Thanks you !
Hey colapsnux!
Thank you for using Enfold.
Why do you need to add the jquery library script again? It is already included by default. You can find the built in WP code on functions.php:
wp_enqueue_script('jquery');
Regards,
Ismael
Ho.. I don’t know why but it’s still working now ..
Maybe it was a bug ..
Thanks you ismael
Have a good day !
Colapsnux