• Hello, I’m using Google stored jQuery in my theme, calling it like this in my functions.php file:

    function bb_google_jquery() {
    	wp_deregister_script('jquery');
    	wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', false, '1.4.4');
    	wp_enqueue_script('jquery');
    }
    
    if(!is_admin()){
    	add_action('init', 'bb_google_jquery');
    }

    The problem is, even if though wrapped in the conditional tag – it stops wp-admin jQuery stuff (sidebar menu dropdowns, dashboard dropdowns) from working. Removing the is_admin makes it work correctly.

    However, I need it to be wrapped into the conditional tag, because otherwise I can’t move menu items around…

    Anything I’m doing wrong with this code?

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • what is wrong with the embeded jQuery?

    Thread Starter Justyna Ratajczak

    (@jusi)

    I can’t make it to work with custom scripts in my theme. I register my scripts in functions.php, like this:

    wp_register_script('selectivizr', get_bloginfo('template_directory').'/_assets/js/selectivizr.js', 'jquery');
    wp_enqueue_script('selectivizr');

    to have them included in wp_head. Then I use wp_enqueue_script("jquery"); in my header.php BEFORE the wp_head but the jQuery is STILL loaded after my scripts anyway.

    Registering Google-hosted version of jQuery forced it to load before my registered scripts to make them work properly. However it made the draggable menu items in Appearance/Menus to stop working. Removing the if(!is_admin()) condition fixes the menu problem, but the dashboard items don’t slide down then (there is no jQuery on the page at all).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Google-loaded jQuery doesn't work in wp-admin’ is closed to new replies.