clear out jquery to prevent conflicts


/ Published in: PHP
Save to your folder(s)

goes in the functions file


Copy this code and paste it in your HTML
  1. /*
  2.  * WordPress Sample function and action
  3.  * for loading scripts in themes
  4.  */
  5.  
  6. // Let's hook in our function with the javascript files with the wp_enqueue_scripts hook
  7.  
  8. add_action( 'wp_enqueue_scripts', 'wpcandy_load_javascript_files' );
  9.  
  10. // Register some javascript files, because we love javascript files. Enqueue a couple as well
  11.  
  12. function wpcandy_load_javascript_files() {
  13.  
  14. wp_deregister_script( 'jquery');
  15.  
  16. wp_register_script( 'jquery', get_template_directory_uri().'/js/jquery-1.8.2.min.js', array(), '1.8.2', false );
  17.  
  18. wp_enqueue_script('jquery');
  19.  
  20.  
  21. wp_register_script( 'jquery.flexslider', get_template_directory_uri().'/js/jquery.flexslider.js', array('jquery'), '1.7', false );
  22.  
  23. wp_enqueue_script('jquery.flexslider');
  24.  
  25.  
  26.  
  27.  
  28. }

URL: http://codex.wordpress.org/Function_Reference/wp_enqueue_script

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.