{"id":2957309,"date":"2012-08-10T10:04:42","date_gmt":"2012-08-10T10:04:42","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/help-with-wp_enqueue\/"},"modified":"2016-08-20T14:51:06","modified_gmt":"2016-08-20T14:51:06","slug":"help-with-wp_enqueue","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/help-with-wp_enqueue\/","title":{"rendered":"Help with wp_enqueue"},"content":{"rendered":"<p>Hi<\/p>\n<p>I&#8217;m trying to add supersized via wp_enqueue and only on certain pages &#8211; but without much luck.<\/p>\n<p>I&#8217;ve currently got the query in the footer with the following PHP &#8211; THIS WORKS..<\/p>\n<pre><code>&lt;?php if ( !( is_page_template(&#039;modelPages.php&#039;) || is_archive() || is_single() || is_page_template(&#039;contactUsTemplate.php&#039;) ) ) { ?&gt;\n&lt;script type=&quot;text\/javascript&quot; src=&quot;&lt;?php echo bloginfo(&#039;template_directory&#039;);?&gt;\/scripts\/supersized.3.2.7.min.js&quot;&gt;&lt;\/script&gt;\n&lt;script type=&quot;text\/javascript&quot; src=&quot;&lt;?php echo bloginfo(&#039;template_directory&#039;);?&gt;\/theme\/supersized.shutter.min.js&quot;&gt;&lt;\/script&gt;\n&lt;?php } ?&gt;<\/code><\/pre>\n<p>However, trying to port that over to my functions file seems to just break super sized full stop&#8230;<\/p>\n<pre><code>function custom_scripts() {\n\tif ( !is_admin() ) {\n\twp_deregister_script(&#039;jquery&#039;);\n\twp_register_script(&#039;jquery&#039;, (&quot;https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.7.2\/jquery.min.js&quot;), false);\n\twp_enqueue_script(&#039;jquery&#039;);\n}\nif( is_page( &#039;home&#039; ) ) :\n\twp_enqueue_script(\n\t&#039;jcarousel&#039;,\n\tget_template_directory_uri() . &#039;\/scripts\/jquery.jcarousel.min.js&#039;,\n\tarray( &#039;jquery&#039; ),\n\tnull,\n\ttrue\n);\nelseif( is_single() ) :\n\twp_enqueue_script(\n\t&#039;slimbox&#039;,\n\tget_template_directory_uri() . &#039;\/scripts\/slimbox2.js&#039;,\n\tarray( &#039;jquery&#039; ),\n\tnull,\n\ttrue\n);\nelseif( !(is_page_template(&#039;modelPages.php&#039;) || is_archive() || is_single() || is_page_template(&#039;contactUsTemplate.php&#039;)  )  ) :\n    \/\/ SUPERSIZED SHOULD GO HERE BUT BREAKS\nendif;\n}    \n\nadd_action( &#039;wp_enqueue_scripts&#039;, &#039;custom_scripts&#039; );<\/code><\/pre>\n<p>It just doesn&#8217;t load it at all &#8211; not even if i add it to the home rule.<\/p>\n<p>Can someone please advise on what I&#8217;m doing wrong? I clearly am getting in a muddle about adding multiple enqueues to a rule&#8230;<\/p>\n","protected":false},"template":"","class_list":["post-2957309","topic","type-topic","status-closed","hentry","topic-tag-supersized","topic-tag-wp_enqueue"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/2957309","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\/2957309\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=2957309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}