WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How Can I add some js files from a plugin to a specific location with add_action

I am Using this widget: http://www.designchemical.com/blog/index.php/wordpress-plugins/wordpress-plugin-jquery-vertical-accordion-menu-widget/

It is adding its file here: After

 <script type='text/javascript' src='http://new.dajewelers.com/wp-includes/js/l10n.js?         ver=20101110'></script>
  <script type='text/javascript' src='http://new.dajewelers.com/wp- includes/js/jquery/jquery.js?ver=1.4.4'></script>

and before these lines:

   <script type='text/javascript' src='http://new.dajewelers.com/wp-includes/js/jquery/ui.core.js?ver=1.8.9'></script>
    <script type='text/javascript' src='http://new.dajewelers.com/wp-includes/js/jquery/ui.widget.js?ver=1.8.9'></script>
    <script type='text/javascript' src='http://new.dajewelers.com/wp-includes/js/jquery/ui.tabs.js?ver=1.8.9'></script>
     <script type='text/javascript' src='http://new.dajewelers.com/wp-includes/js/jquery/ui.mouse.js?ver=1.8.9'></script>
    <script type='text/javascript' src='http://new.dajewelers.com/wp-includes/js/jquery/ui.resizable.js?ver=1.8.9'></script>

Its code is basically for accordion and I think it is not working because it is coming before JQuery.ui files. So I want it to come after UI Files.

Please can some one figure out the problem or if same is problem then how to fix that.

And this is wp code that is doing so

        // Header styles
        add_action( 'wp_head', array('dc_jqaccordion', 'header') );

        // Scripts
        wp_enqueue_script( 'jquery' );
        wp_enqueue_script( 'jqueryhoverintent', dc_jqaccordion::get_plugin_directory() . '/js/jquery.hoverIntent.minified.js', array('jquery') );
        wp_enqueue_script( 'jquerycookie', dc_jqaccordion::get_plugin_directory() . '/js/jquery.cookie.js', array('jquery') );
        wp_enqueue_script( 'dcjqaccordion', dc_jqaccordion::get_plugin_directory() . '/js/jquery.dcjqaccordion.2.8.js', array('jquery') );

Here is the link where all this is : http://new.dajewelers.com

Please tell if you have any idea.

thanks in advance.

share|improve this question
up vote 0 down vote accepted

you have a $ undefined js error on line 191. wp_enqueue_script has a dependencies parameter, I think you need to pass the jquery-ui handle as a dependency with your accordion script so it loads first.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.