Enqueued scripts: inspecting / editing dependencies (1 post)

  1. Wabsnasm
    Posted 3 years ago #

    In my theme at the moment, I have scripts.js dependent on jquery.js and jquery-plugin.js. Now, that's all fine, and I have those two dependencies listed when I register the script.

    But, on my contact page, I use an additional script: gmap.js. On this page, scripts.js is dependent on this as well. So, at the moment, I do the following :

    if( is_page('contact') ) {
      wp_enqueue_script('scripts.js', 'js/scripts.js', array('jquery','jquery-plugin.js','gmap.js'));

    My question is is there a better way of adding the dependency for just that page?

    Maybe something like $array = get_dependencies('script.js'); and set_dependencies('script.js', $array);.

    Thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Topic