Trouble Adding JQuery Plugin to WordPress Theme
-
Howdy!
I’m relatively new to JQuery and javascript, particularly when used in conjunction with WordPress. I have a JQuery plugin (turn.js http://www.turnjs.com/) and have been trying to get it up and running on this site: bondinchair.com, with no luck.
I’ve reviewed the Codex and various how-to’s and tutorials. The plugin works fine on a standalone html page, but not with WordPress. As far as I can tell, I’ve registered and enqueue’d the javascript properly, but I am still having no luck. I fear I am missing something simple.
Here’s the section of code in question, I think:
function my_init() { if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.3.2', true); wp_enqueue_script('jquery'); wp_enqueue_script('my_script', get_bloginfo('template_url') . '/js/basic.js', array('jquery'), '1.0', true); } } add_action('init', 'my_init'); function turn_jquery() { wp_enqueue_script( 'turn' ); wp_register_script( 'turn', get_template_directory_uri() . '/js/basic.js'); wp_register_style('turncss',get_template_directory_uri().'/css/basic.css'); wp_enqueue_style('turncss'); } add_action( 'wp_enqueue_scripts', 'turn_jquery' ); ?>Many thanks in advance for any help.
The topic ‘Trouble Adding JQuery Plugin to WordPress Theme’ is closed to new replies.