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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Never, EVER, de-register core jQuery!

    Thread Starter wingmanjp

    (@wingmanjp)

    Ok.

    Thanks.

    Is that my problem?

    Thread Starter wingmanjp

    (@wingmanjp)

    Incidentally, I found the script that deregistered core JQuery on this forum. I think this is part of the problem. Lots of bad info and half-formed answers. As I said, I’m new, but willing to do my homework.

    😀

    If it isn’t now, it will be. De-registering core jQuery can cause all kinds of problems in a site – both on the back and front end. What’s wrong with using the version of jQuery bundled with core?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Trouble Adding JQuery Plugin to WordPress Theme’ is closed to new replies.