Advertisement
techouse

include jquery + jquery-ui in WP functions.php

Mar 16th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. // Load jQuery & jQuery UI
  2. function load_my_jquery() {
  3.     wp_deregister_script("jquery");
  4.     wp_deregister_script("jquery-ui");
  5.     wp_deregister_script("jquery-ui-core");
  6.     wp_deregister_script("jquery-ui-tabs");
  7.     wp_deregister_script("jquery-ui-sortable");
  8.     wp_deregister_script("jquery-ui-draggable");
  9.     wp_deregister_script("jquery-ui-droppable");
  10.     wp_deregister_script("jquery-ui-selectable");
  11.     wp_deregister_script("jquery-ui-resizable");
  12.     wp_deregister_script("jquery-ui-dialog");
  13.     wp_register_script("jquery", "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", array(), "1.7.1", true);
  14.     wp_register_script("jquery-ui", "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js", array("jquery"), "1.8.18", true);
  15. }
  16.  
  17. function print_my_jquery() {
  18.     global $add_my_jquery;
  19.     if (!$add_my_jquery) { return; }
  20.     wp_print_scripts('jquery', 'jquery-ui');
  21. }
  22.  
  23. if (!is_admin()) {
  24.     add_action("init", "load_my_jquery");
  25.     add_action("wp_footer", "print_my_jquery");
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement