Advertisement
brook-tribe

Use Default WP jQuery Scripts

Mar 26th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. /*
  2.  This snippet is intended to fix themes that override form the default jQuery scripts.
  3.  Add this to your theme's functions.php file.
  4.  */
  5.  
  6. // Reregisters default jquery scripts
  7. // Might cause conflicts with themes that use outdated jQuery plugins
  8. function use_wp_default_scripts() {
  9.  
  10.     wp_dequeue_script('jquery');
  11.     wp_deregister_script('jquery');
  12.     wp_dequeue_script('jquery-core');
  13.     wp_deregister_script('jquery-core');
  14.     wp_dequeue_script('jquery-migrate');
  15.     wp_deregister_script('jquery-migrate');
  16.     wp_dequeue_script('jquery-ui-core');
  17.     wp_deregister_script('jquery-ui-core');
  18.     wp_dequeue_script('jquery-ui-datepicker');
  19.     wp_deregister_script('jquery-ui-datepicker');
  20.  
  21.  
  22.     wp_register_script(
  23.         'jquery-migrate',
  24.         '/wp-includes/js/jquery/jquery-migrate.min.js'
  25.     );
  26.     wp_register_script(
  27.         'jquery-core',
  28.         '/wp-includes/js/jquery/jquery.js'
  29.     );
  30.     wp_register_script(
  31.         'jquery',
  32.         false,
  33.         array('jquery-core', 'jquery-migrate')
  34.     );
  35.     wp_register_script(
  36.         'jquery-ui-core',
  37.         '/wp-includes/js/jquery/ui/jquery.ui.core.min.js',
  38.         array('jquery')
  39.     );
  40.     wp_register_script(
  41.         'jquery-ui-datepicker',
  42.         '/wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js',
  43.         array('jquery-ui-core')
  44.     );
  45.  
  46.     wp_enqueue_script('jquery-core');
  47.     wp_enqueue_script('jquery-migrate');
  48.     wp_enqueue_script('jquery');
  49.     wp_enqueue_script('jquery-ui-core');
  50.     wp_enqueue_script('jquery-ui-datepicker');
  51. }
  52. add_action( 'wp_print_scripts', 'hide_tribe_placeholders', 100 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement