wp_enqueue_script problem!
-
Hi.
I found may be a bug with wp_register_script/wp_enqueue_script.
I have some handle-scripts like jquery, jquery-ui to enqueue, its ok. Also I have my known js-files to enqueue, ok too. BUT! When I want to enqueue dynamic js (gets from folders), it enqueue too BUT BEFORE jquery, jquery-ui itc. Some code:wp_enqueue_script('jquery'); //ok wp_register_script('jquery-ui-tabs-rotate', plugins_url('js/jquery-ui-tabs-rotate.js', $this->indexFile/*my index file*/), self::$_requiredJSHandles /* this is like array('jquery')*/); wp_enqueue_script('jquery-ui-tabs-rotate');//ok foreach ($this->_enabledSliders as $slidernum) { $skin_name = self::_lenslider_get_slider_skin_name($slidernum); if($skin_name != self::$defaultSkin) { $skinObjStatic = LenSliderSkins::lenslider_get_skin_params_object($skin_name); if(!empty($skinObjStatic->jsFiles) && is_array($skinObjStatic->jsFiles)) { foreach ($skinObjStatic->jsFiles as $filename) { $reg_name = str_ireplace(".js", '', basename($filename)."-{$skin_name}"); wp_register_script($reg_name, str_ireplace(ABSPATH, self::$siteurl."/", $filename), self::$_requiredJSHandles);//ok but goes BEFORE jquery and jquery-ui wp_enqueue_script($reg_name); } } ....
The html output:
<!--NEED TO GO AFTER JQUERY AND JQUERY UI LOAD--> <script type='text/javascript' src='https://site.com/wp-content/plugins/len-slider/skins/nemo_target/output/js/nemo-target-skin.js?ver=3.5-RC2'></script> <!--NEED TO GO AFTER JQUERY AND JQUERY UI LOAD--> <script type='text/javascript' src='https://site.com/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script> <script type='text/javascript' src='https://site.com/wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.9.2'></script>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘wp_enqueue_script problem!’ is closed to new replies.