How to undo deregister script and use local versions?

The WordPress theme I am using deregisters the jQuery and jQuery UI libraries and registers google-hosted versions instead of the libraries from wp-includes. Here is the code in `functions.
UPDATE:

function w3t_add_scripts() {
    $options = get_option('lollipop');
    global $data; //get theme options

    wp_enqueue_script('jquery');    
    wp_enqueue_script('jquery-ui');

    // Site wide js
    wp_enqueue_script('modernizr', get_template_directory_uri() . '/js/modernizr.min.js');
    wp_enqueue_script('customscript', get_template_directory_uri() . '/js/customscript.js');

    //Slider
    if($options['w3t_featured_slider'] == '1') {
    //  if(is_front_page() || is_page()) {
            wp_enqueue_script('cslider', get_template_directory_uri() . '/js/jquery.cslider.js');
    //  }
    }

    //Lightbox
    if($options['w3t_lightbox'] == '1') {
        wp_enqueue_script('prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js');
    }
}
add_action('wp_enqueue_scripts','w3t_add_scripts');

That’s how the entire function looks like now. i did what you suggested, but it’s not loading the jquery or jquer-ui files

Related posts

1 comment

  1. If that code is written into the theme just like that– that is, it isn’t hooked into wp_enqueue_scripts like is should be– then you can’t “undo” this without hacking the theme.

    I should add that if the theme has this code in functions.php just like that and not hooked then the theme is doing it wrong and if you had debugging enabled you’d see this:

    Notice: wp_deregister_script was called incorrectly. Scripts and
    styles should not be registered or enqueued until the
    wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts
    hooks. Please see Debugging in WordPress for more information.

    You need to remove the code and (possibly) add this:

    function enqueue_scripts_wpse_110500() {
      wp_enqueue_script('jquery-ui');
    }
    add_action('wp_enqueue_scripts','enqueue_scripts_wpse_110500');
    

    With that code, WordPress should load jQuery itself automatically.

    I would advise against using a theme that is doing something so fundamental as this incorrectly. No telling what other sloppiness there is in the theme.

Comments are closed.