Add jquery script the right way
-
Hello,
I have a small script which needs jqueary, so I add this to my header:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
now it works, but I think it is not the right way to do it, I think it needs to be done with wp_enqueue_scripts
but when I add this to function.php
<?php function my_slider() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'); wp_enqueue_script( 'jquery' ); } add_action('wp_enqueue_scripts', 'my_slider'); ?>
it doesn’t work,
so what do I forget?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Add jquery script the right way’ is closed to new replies.