{"id":6608081,"date":"2015-10-02T15:42:19","date_gmt":"2015-10-02T15:42:19","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/enqueue-scripts-again\/"},"modified":"2016-08-30T18:40:27","modified_gmt":"2016-08-30T18:40:27","slug":"enqueue-scripts-again","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/enqueue-scripts-again\/","title":{"rendered":"Enqueue scripts &#8211; again"},"content":{"rendered":"<p>I know this has been asked about a million times. I&#8217;ve searched and gone through guides and instructions on how to do this for days and I&#8217;m clearly still doing something wrong. My jquery just won&#8217;t work. I&#8217;ve tried following instructions for registering and enqueueing the scripts, and instructions for wrapping the jquery, etc. Nothing seems to help. So I&#8217;m hoping that if I show you my code for enqueueing the script, you can tell me what is wrong. I&#8217;ve tried several different instructions for enqueueing it and apparently, I just can&#8217;t wrap my brain around it. <\/p>\n<p>Here is my code:<\/p>\n<p>function duckstyles()<br \/>\n{<br \/>\n    wp_enqueue_style( &#8216;style&#8217;, get_template_directory_uri() . &#8216;\/style.css&#8217; );<br \/>\n    wp_register_script( &#8216;duckapp&#8217;, get_template_directory_uri() . &#8216;\/duckapp.js&#8217;, __FILE__, array( &#8216;jquery&#8217; ), 1.0, true);<br \/>\n    wp_enqueue_script( &#8216;duckapp&#8217;, get_template_directory_uri() . &#8216;\/duckapp.js&#8217;, __FILE__, array( &#8216;jquery&#8217; ), 1.0, true);<br \/>\n}<br \/>\nadd_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;duckstyles&#8217; );<\/p>\n<p>my js file is located in the same directory as the functions.php file, the main theme directory. The CSS works. The only javascript I have for the wordpress page is a script that changes the header&#8217;s class when you scroll down on the page. It worked fine before I started trying to enqueue the scripts. I feel bad asking about something that has been posted so many times, but apparently I lack the ability to follow the instructions in the various websites and other posts. :\/ <\/p>\n<p>Thanks.<\/p>\n","protected":false},"template":"","class_list":["post-6608081","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6608081","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\/6608081\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6608081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}