[wp-hackers] Troubling with jQuery (UI/Slider) and/or wp_enqueue_script()

Frank Helmschrott fhelmschrott at gmail.com
Sun May 31 07:47:05 GMT 2009


Hi,

i'm dealing with my first completely self written plugin for 2 days
now (hooray).

After i found everything quite simple i've already spent some hours
now fiddling around to get the jQuery UI Sliders running on my plugins
option page. I'm trying to completely do this via wp_enqueue_script
and without adding some manual <script src...> stuff - i think that's
the way it should work.

Here's the method that enqueues the important stuff:

			function register_admin_scripts()
			{
				wp_enqueue_script('jquery-ui-slider',
$this->plugin_url.'js/ui.slider.js',array('jquery','jquery-ui-core'),'1.7.1');
				wp_enqueue_script('men-at-work',
$this->plugin_url.'men-at-work.js',
array('jquery','farbtastic'),'1.0');
			}

it get's called via init action which basically works.

That's what the output source looks like:

<script type='text/javascript'
src='http://.../wp-admin/load-scripts.php?c=1&amp;load=jquery,jquery-ui-core,farbtastic,utils&amp;ver=fbed8cd2dbd177766385eb010c7aaea1'></script>
<script type='text/javascript'
src='http://.../wp-content/plugins/men-at-work/js/ui.slider.js?ver=1.7.1'></script>
<script type='text/javascript'
src='http://.../wp-content/plugins/men-at-work/men-at-work.js?ver=1.0'></script>

jQuery basically works, Farbtastic color picker works. What doesn't
work is the slider. I get the following error through firebug:

F is undefined
http://.../wp-admin/load-scripts.php?c=1&load=jquery,jquery-ui-core,farbtastic,utils&ver=fbed8cd2dbd177766385eb010c7aaea1
Line 12

Line12 is the basic jQuery stuff.

Two questions:

- Does anybody now where this error may come from? I guess the loading
order should be ok

the second is a more basic one:

- Why do jquery-ui-slider and my script not get loaded via the
load-scripts.php? Is there any way to get that working (not really a
matter in this case but could be a performance win on the public
pages).

Thanks for helping!

-- 
Frank


More information about the wp-hackers mailing list