bakedproject.com Blog Not just another WordPress weblog

4Oct/101

Using jQuery UI with WordPress

I started developing with WordPress 3.0+ these days and figuring out a few things!.

WP loads a few jQuery libraries by default, so being a plugin developer you do not explicitly need to load those libraries, or that is what they have suggested. The original list is here http://codex.wordpress.org/Function_Reference/wp_enqueue_script.

I could not get the jQuery UI working for the widgets! The widget control does not load any UI component, the tabs are already "sortable" and "draggable". This probably is the reason. jQuery UI was not working on the actual widget display either. I tried a few things before remembering, a while ago I had to call the the jQuery UI init functions all the way to the bottom for a challenging project. We were using jQuery Light Box and some other components. The jQuery UI initi simply wont work if the call was made before

So this is my call

1
wp_enqueue_script('myscript', '/wp-content/plugins/bp-category-display/js/myscript.js', array('jquery', 'jquery-ui-core','jquery-ui-sortable'), '', true);

the important thing is, enqueuing the script to the end of the document, this the last 'true'.

Filed under: Uncategorized 1 Comment