Saving jQuery UI Sortable on WordPress
Saving jQuery UI Sortable on WordPress
Saving jQuery UI Sortable on WordPress
Try to load the script in the footer section. <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js”></script> <script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js”></script> <script type=”text/javascript”> $(document).ready(function(){ $(“#clientAutocomplete”).autocomplete({ source:’client_autocomplete.php’, minLength:1 }); }); </script> This worked for me
This works for me locally in testing.. add_action(‘wp_enqueue_scripts’,’enq_menu_scripts_and_styles’); function enq_menu_scripts_and_styles() { // UI Core, loads jQuery as a dependancy wp_enqueue_script( ‘uicore’, ‘http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js’, array(‘jquery’) ); // UI Theme CSS wp_enqueue_style( ‘uicss’, ‘http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-darkness/jquery-ui.css’ ); // Selectmenu JS wp_enqueue_script( ‘uisel’, ‘http://jquery-ui.googlecode.com/svn/branches/labs/selectmenu/ui.selectmenu.js’ ); // Selectmenu CSS wp_enqueue_style( ‘uicss2’, ‘http://jquery-ui.googlecode.com/svn/branches/labs/selectmenu/ui.selectmenu.css’ ); } add_action(‘wp_head’,’select_menu_test_code’); // Simple test code function select_menu_test_code() { … Read more
CSS needs to be in the head of the document. Use the admin_enqueue_scripts hook instead. Also be sure to only enqueue the scripts and styles on screens where you need them.
As I stated in the comments. You need to have jQuery and jQuery UI loaded in order to use the autocomplete UI. I modified your hook to have dependencies on the required libraries. Now all you need to do is set the path to your custom js file that initializes autocomplete. The dependencies will load … Read more
After a bit of investigation, the following code will add touch events to the Iris picker which uses jQuery UI. I did have to make the color picker handle 25px x 25px so it’s easier to grab on an iPad, but other than that this works: $(document).on({ touchstart: touchHandler, touchmove: touchHandler, touchend: touchHandler, touchcancel: touchHandler … Read more
jquery is enqueued by default on admin side. So, it may not be loading due to your wp_enqueue_script statement. Are you using wp_enqueue_script inside some action hook? Because you have to. I use it like this: add_action( ‘admin_enqueue_scripts-options_page-{page}’, ‘myplugin_admin_scripts’ ); function myplugin_admin_scripts() { wp_enqueue_script(‘jquery’); wp_enqueue_script(‘jquery-ui-core’); }
Here ya go … try this: /* add jquery ui datepicker and theme */ global $wp_scripts; wp_enqueue_script(‘jquery-ui-datepicker’); $ui = $wp_scripts->query(‘jquery-ui-core’); $url = “https://ajax.aspnetcdn.com/ajax/jquery.ui/{$ui->ver}/themes/redmond/jquery.ui.all.css”; wp_enqueue_style(‘jquery-ui-redmond’, $url, false, $ui->ver); This is what I use in my plugin to load a theme. That CDN has all the basic jquery-ui themes. Hope this helps …
The short answer is that you need to include a jQuery UI CSS “Theme” with your code. The jQuery UI framework is actually a combination of JavaScript and CSS (and it looks like you’ve only included the JavaScript). As a quick test, I just applied the “Base” theme to your code here. (Notice on the … Read more
I guess you have to really read the Codex about wp_enqueue_script() again and then dig into jQuery a little bit more. jQuery UI is a dependency of jQuery (which means it depends on having jQuery loaded). So you need to load jQuery first, before loading jQuery UI (or jQuery UI Mobile). Edit as per @ChipBennet … Read more