Return to Snippet

Revision: 60433
at November 8, 2012 04:34 by thesmu


Initial Code
/*
 * WordPress Sample function and action
 * for loading scripts in themes
 */
 
// Let's hook in our function with the javascript files with the wp_enqueue_scripts hook 

add_action( 'wp_enqueue_scripts', 'wpcandy_load_javascript_files' );

// Register some javascript files, because we love javascript files. Enqueue a couple as well 

function wpcandy_load_javascript_files() {

wp_deregister_script( 'jquery');  

wp_register_script( 'jquery', get_template_directory_uri().'/js/jquery-1.8.2.min.js', array(), '1.8.2', false );  

wp_enqueue_script('jquery');


wp_register_script( 'jquery.flexslider', get_template_directory_uri().'/js/jquery.flexslider.js', array('jquery'), '1.7', false );  

wp_enqueue_script('jquery.flexslider');




}

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

Initial Description
goes in the functions file

Initial Title
clear out jquery to prevent conflicts

Initial Tags
php, wordpress, jquery, function

Initial Language
PHP