• Hey, I’ve been trying to get this plugin to work right. It does what it should in Chrome, but in FireFox and IE it does not work.

    Basically where FF and IE and messing up is with the wp_enqueue_script(‘jquery’) function.

    function load_scripts()
    {
        wp_enqueue_script('jquery');
    }
    add_action('init', 'load_scripts');

    I have also tried to use add_action('wp_enqueue_scripts', 'load_scripts'); And that did not work either.

    Why is it that jQuery is not being loaded according to FF and IE?.

    Should I being doing something different to load it?
    Any input would be greatly appreciated, thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m working on my first plugin and here’s what’s working for me:

    Create a function to both register AND enqueue the script and then add_action to call the function (the !is_admin condition is to avoid loading the script while in the admin panel if it’s not needed there )

    function load_scripts() {
    	if (!is_admin()){
    		wp_register_script( 'my_script', plugins_url( '/jquery.js', __FILE__ ));
    		wp_enqueue_script( 'my_script' );
    	}
    }
    add_action('wp_enqueue_scripts', 'load_scripts');
    Thread Starter BFreitag04

    (@bfreitag04)

    The only thing about that though is they do not want us to use our own jQuery file, they are wanting us to use the one that is prepackaged with WordPress.

    How I have it works in Chrome but not FF or IE, so I’m just curious as to the reason.

    In the codex it shows that the handle for their jQuery file is just ‘jquery’, so one should be able to use ‘wp_enqueue_script(‘jquery’).’

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with wp_enqueue_script('jquery')’ is closed to new replies.