Posted By

thesmu on 11/08/12


Tagged

php wordpress jquery function


Versions (?)

clear out jquery to prevent conflicts


 / Published in: PHP
 

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

goes in the functions file

  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. }

Report this snippet  

You need to login to post a comment.