{"id":4713005,"date":"2014-03-16T18:45:05","date_gmt":"2014-03-16T18:45:05","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/wp_enqueue-use-in_footer\/"},"modified":"2016-08-21T17:20:21","modified_gmt":"2016-08-21T17:20:21","slug":"wp_enqueue-use-in_footer","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/wp_enqueue-use-in_footer\/","title":{"rendered":"wp_enqueue use in_footer"},"content":{"rendered":"<p>So I bought a custom theme, and the devs over there have absolutely no clue what they did apparantly. I&#8217;ve read the wp_enqueue part in the codex. But their way of doing this is completely new to me. I want to make sure all .js gets loaded in the footer. But I&#8217;m unsure how to do it in this case:<\/p>\n<p>N.B.: yes I know, too much .js, this theme sucks but it&#8217;ll have to do for now.<\/p>\n<pre><code>function aitEnqueueScriptsAndStyles()\n{\n\t\/\/ just shortcuts\n\t$s = THEME_CSS_URL;\n\t$j = THEME_JS_URL;\n\n\taitAddStyles(array(\n\t\t&#039;ait-jquery-prettyPhoto&#039;  =&gt; array(&#039;file&#039; =&gt; &quot;$s\/prettyPhoto.css&quot;),\n\t\t&#039;ait-jquery-fancybox&#039;     =&gt; array(&#039;file&#039; =&gt; &quot;$s\/fancybox\/jquery.fancybox-1.3.4.css&quot;),\n\t\t&#039;ait-jquery-hover-zoom&#039;   =&gt; array(&#039;file&#039; =&gt; &quot;$s\/hoverZoom.css&quot;),\n\t\t&#039;ait-jquery-fancycheckbox&#039;=&gt; array(&#039;file&#039; =&gt; &quot;$s\/jquery.fancycheckbox.min.css&quot;),\n\t\t&#039;jquery-ui-css&#039;           =&gt; array(&#039;file&#039; =&gt; &quot;$s\/jquery-ui-1.10.1.custom.min.css&quot;),\n\t));\n\n\taitAddScripts(array(\n\t\t&#039;jquery-ui-tabs&#039;              =&gt; true,\n\t\t&#039;jquery-ui-accordion&#039;         =&gt; true,\n\t\t&#039;jquery-ui-autocomplete&#039;      =&gt; true,\n\t\t&#039;jquery-ui-slider&#039;            =&gt; true,\n\t\t&#039;ait-jquery-fancycheckbox&#039;    =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.fancycheckbox.min.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-html5placeholder&#039; =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.html5-placeholder-shim.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-googlemaps-api&#039;          =&gt; array(&#039;file&#039; =&gt; &#039;http:\/\/maps.google.com\/maps\/api\/js?sensor=false&amp;language=en&#039;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-gmap3-label&#039;      =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/gmap3.infobox.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-gmap3&#039;            =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/gmap3.min.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-infieldlabel&#039;     =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.infieldlabel.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-prettyPhoto&#039;      =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.prettyPhoto.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-fancybox&#039;         =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.fancybox-1.3.4.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-easing&#039;           =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.easing-1.3.min.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-nicescroll&#039;       =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.nicescroll.min.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-quicksand&#039;        =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.quicksand.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-hover-zoom&#039;       =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/hover.zoom.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-jquery-finished-typing&#039;  =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/jquery.finishedTyping.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-spin-ajax-loader&#039;        =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/spin.min.js&quot;),\n\t\t&#039;ait-modernizr-touch&#039;         =&gt; array(&#039;file&#039; =&gt; &quot;$j\/libs\/modernizr.touch.js&quot;),\n\t\t&#039;ait-gridgallery&#039;             =&gt; array(&#039;file&#039; =&gt; &quot;$j\/gridgallery.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-rating&#039;                  =&gt; array(&#039;file&#039; =&gt; &quot;$j\/rating.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t\t&#039;ait-script&#039;                  =&gt; array(&#039;file&#039; =&gt; &quot;$j\/script.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;)),\n\t));\n\twp_localize_script( &#039;ait-script&#039;, &#039;MyAjax&#039;, array( &#039;ajaxurl&#039; =&gt; admin_url( &#039;admin-ajax.php&#039; ), &#039;ajaxnonce&#039; =&gt; wp_create_nonce(&#039;ajax-nonce&#039;) ) );\n}\nadd_action(&#039;wp_enqueue_scripts&#039;, &#039;aitEnqueueScriptsAndStyles&#039;);<\/code><\/pre>\n<p>So I changed that crap to this (I&#8217;ll just show one rule instead of all the code): <\/p>\n<p><code>&#039;ait-script&#039;                  =&gt; array(&#039;file&#039; =&gt; &quot;$j\/script.js&quot;, &#039;deps&#039; =&gt; array(&#039;jquery&#039;), &#039;&#039;, true),<\/code><\/p>\n<p>The script isn&#8217;t loaded in the footer yet. Any ideas?<\/p>\n","protected":false},"template":"","class_list":["post-4713005","topic","type-topic","status-closed","hentry","topic-tag-wp_enqueue"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4713005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4713005\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4713005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}