I have a file in my theme's JS folder named cycle2.js.
How do I include the Jquery from 'wordpress→includes' into my theme?
How do I load this custom JavaScript file 'cycle2.js' into my theme?
I have:
function watercolor_js_scripts(){ if (!is_admin()) { wp_register_script('cycle2', get_template_directory_uri() . '/js/cycle2.js', 'jquery', TRUE); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'cycle2' ); } add_action('init', 'watercolor_js_scripts'); }
I can't understand any of the many explanations of this. Can some please just provide a copy/paste solution to throw into functions.php that will include the basic Jquery library included with WordPress & the cycle2.js file in my theme's js folder?