<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>ThemeShaper Forums Tag: wp_enqueue_script</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Thu, 23 May 2013 06:13:10 +0000</pubDate>

<item>
<title>helgatheviking on "Replace Jquery on wp_enqueue_script"</title>
<link>http://themeshaper.com/forums/topic/replace-jquery-on-wp_enqueue_script#post-26687</link>
<pubDate>Fri, 27 Apr 2012 20:25:34 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">26687@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;yes and you should add that to the proper hook&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function kia_change_jquery(){
wp_deregister_script(&#38;#39;jquery&#38;#39;);
wp_register_script( &#38;#39;jquery&#38;#39;, &#38;#39;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&#38;#39;, &#38;#39;1.7.2&#38;#39;);
}
add_action(&#38;#39;wp_enqueue_scripts&#38;#39;,&#38;#39;kia_change_jquery&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>SpacemanSpiff on "Replace Jquery on wp_enqueue_script"</title>
<link>http://themeshaper.com/forums/topic/replace-jquery-on-wp_enqueue_script#post-26686</link>
<pubDate>Fri, 27 Apr 2012 19:44:52 +0000</pubDate>
<dc:creator>SpacemanSpiff</dc:creator>
<guid isPermaLink="false">26686@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I found the solution, this replaces the default jquery with the jquery hosted on google API.&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;wp_deregister_script(&#38;#39;jquery&#38;#39;);
wp_register_script( &#38;#39;jquery&#38;#39;, &#38;#39;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&#38;#39;, &#38;#39;1.7.2&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>helgatheviking on "Replace Jquery on wp_enqueue_script"</title>
<link>http://themeshaper.com/forums/topic/replace-jquery-on-wp_enqueue_script#post-26394</link>
<pubDate>Tue, 17 Apr 2012 21:58:55 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">26394@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;this is not a thematic question, but why not upgrade wordpress to 3.3?  that uses jquery 1.7ish i think.  if not look in the codex for how to deregister a script.
&#60;/p&#62;</description>
</item>
<item>
<title>SpacemanSpiff on "Replace Jquery on wp_enqueue_script"</title>
<link>http://themeshaper.com/forums/topic/replace-jquery-on-wp_enqueue_script#post-26393</link>
<pubDate>Tue, 17 Apr 2012 21:34:43 +0000</pubDate>
<dc:creator>SpacemanSpiff</dc:creator>
<guid isPermaLink="false">26393@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I notice that the wp_enqueue_script('jquery') on function.php is loading the version 1.4.4. This is because i'm using WP 3.1.4 due to the php version on my server.&#60;br /&#62;
Is there a way to replace the old version of jquery with a newer one?
&#60;/p&#62;</description>
</item>
<item>
<title>middlesister on "wp_enqueue_script called incorrectly (Wordpress 3.3 Beta)"</title>
<link>http://themeshaper.com/forums/topic/wp_enqueue_script-called-incorrectly-wordpress-33-beta#post-23700</link>
<pubDate>Fri, 04 Nov 2011 12:11:56 +0000</pubDate>
<dc:creator>middlesister</dc:creator>
<guid isPermaLink="false">23700@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I just realized the OP was using the code in thematic's functions.php and not in a child theme. &#60;/p&#62;
&#60;p&#62;@caysays: To remove the notice, simply replace &#60;code&#62;wp_enqueue_script(&#38;#39;jquery&#38;#39;);&#60;/code&#62; with &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function thematic_enqueue_scripts() {
    wp_enqueue_script(&#38;#39;jquery&#38;#39;);
}
add_action(&#38;#39;wp_enqueue_scripts&#38;#39;, &#38;#39;thematic_enqueue_scripts&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>middlesister on "wp_enqueue_script called incorrectly (Wordpress 3.3 Beta)"</title>
<link>http://themeshaper.com/forums/topic/wp_enqueue_script-called-incorrectly-wordpress-33-beta#post-23687</link>
<pubDate>Thu, 03 Nov 2011 21:48:39 +0000</pubDate>
<dc:creator>middlesister</dc:creator>
<guid isPermaLink="false">23687@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Actually, there is no need to enqueue jquery separately. Declaring it as a dependency will make wordpress include it, that is what the parameter is for. If I understand correctly, you could even declare a dependency like &#60;code&#62;array( &#38;#39;jquery&#38;#39;, &#38;#39;jquery-ui-draggable&#38;#39;, &#38;#39;jquery-ui-sortable&#38;#39; )&#60;/code&#62; and wordpress will include them before your script. caseysays code looks like it is taken straight from the codex, so it should work without problems.&#60;/p&#62;
&#60;p&#62;Regarding calling wp_enqueue_script() directly, well you can but it is not recommended. I think they just added the notice in the latest wordpress version to notify theme authors about that. In general, it is a good idea to have &#60;em&#62;all&#60;/em&#62; code added to some kind of hook and not run in the main body of the file. This gives you more control over when things are run and in which order, and will avoid conflicts and errors in other cases (such as trying to call custom taxonomies or use conditionals before they are set up).&#60;/p&#62;
&#60;p&#62;Maybe a bug should be filed for this.
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "wp_enqueue_script called incorrectly (Wordpress 3.3 Beta)"</title>
<link>http://themeshaper.com/forums/topic/wp_enqueue_script-called-incorrectly-wordpress-33-beta#post-23682</link>
<pubDate>Thu, 03 Nov 2011 16:48:26 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">23682@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;maybe you can't call wp_enqueue_scripts() directly any more&#60;/p&#62;
&#60;p&#62;i'm surprised that this works b/c your custom-script won't even load w/o jquery (since the array('jquery') means that jquery is a dependency)..&#60;/p&#62;
&#60;p&#62;btw- you don't need to register and then enqueue.... enqueue will auto-register something that isn't already registered&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function my_scripts_method() {

//enqueue jquery
wp_enqueue_script(&#38;#39;jquery&#38;#39;);

// enqueue the script
wp_enqueue_script(&#38;#39;custom_script&#38;#39;,
get_template_directory_uri() . &#38;#39;/js/custom_script.js&#38;#39;,
array(&#38;#39;jquery&#38;#39;),
&#38;#39;1.0&#38;#39; );
}
add_action(&#38;#39;wp_enqueue_scripts&#38;#39;, &#38;#39;my_scripts_method&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>sergiovieira on "wp_enqueue_script called incorrectly (Wordpress 3.3 Beta)"</title>
<link>http://themeshaper.com/forums/topic/wp_enqueue_script-called-incorrectly-wordpress-33-beta#post-23681</link>
<pubDate>Thu, 03 Nov 2011 10:14:10 +0000</pubDate>
<dc:creator>sergiovieira</dc:creator>
<guid isPermaLink="false">23681@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;This fixed it for me, thanks!
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "wp_enqueue_script called incorrectly (Wordpress 3.3 Beta)"</title>
<link>http://themeshaper.com/forums/topic/wp_enqueue_script-called-incorrectly-wordpress-33-beta#post-23672</link>
<pubDate>Wed, 02 Nov 2011 05:33:51 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">23672@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;you removed the script that enqueues jquery?
&#60;/p&#62;</description>
</item>
<item>
<title>caseysays on "wp_enqueue_script called incorrectly (Wordpress 3.3 Beta)"</title>
<link>http://themeshaper.com/forums/topic/wp_enqueue_script-called-incorrectly-wordpress-33-beta#post-23670</link>
<pubDate>Wed, 02 Nov 2011 04:51:27 +0000</pubDate>
<dc:creator>caseysays</dc:creator>
<guid isPermaLink="false">23670@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Unfamiliar with bbPress forums so forgive me if this has been answered elsewhere; I couldn't find an answer.&#60;/p&#62;
&#60;p&#62;Fresh install of Thematic on Wordpress 3.3Beta2 gave the following error:&#60;/p&#62;
&#60;p&#62;&#34;Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks.&#34;&#60;/p&#62;
&#60;p&#62;Following the instructions at &#60;a href=&#34;http://codex.wordpress.org/Function_Reference/wp_enqueue_script&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Function_Reference/wp_enqueue_script&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I replaced &#34;wp_enqueue_script('jquery');&#34; on line 80 of the functions.php with the following:&#60;/p&#62;
&#60;p&#62;function my_scripts_method() {&#60;br /&#62;
   // register your script location, dependencies and version&#60;br /&#62;
   wp_register_script('custom_script',&#60;br /&#62;
       get_template_directory_uri() . '/js/custom_script.js',&#60;br /&#62;
       array('jquery'),&#60;br /&#62;
       '1.0' );&#60;br /&#62;
   // enqueue the script&#60;br /&#62;
   wp_enqueue_script('custom_script');&#60;br /&#62;
}&#60;br /&#62;
add_action('wp_enqueue_scripts', 'my_scripts_method');&#60;/p&#62;
&#60;p&#62;I'm new to Thematic and I just wanted to confirm with someone that this will work without messing anything up down the road.
&#60;/p&#62;</description>
</item>
<item>
<title>Chris on "Toggle/Show/Hide a widget or div."</title>
<link>http://themeshaper.com/forums/topic/toggleshowhide-a-widget-or-div#post-6458</link>
<pubDate>Sat, 12 Sep 2009 15:47:54 +0000</pubDate>
<dc:creator>Chris</dc:creator>
<guid isPermaLink="false">6458@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;you forgot a &#60;code&#62;)&#60;/code&#62; before closing the script tag.&#60;/p&#62;
&#60;p&#62;Chris
&#60;/p&#62;</description>
</item>
<item>
<title>Brydave on "Toggle/Show/Hide a widget or div."</title>
<link>http://themeshaper.com/forums/topic/toggleshowhide-a-widget-or-div#post-6440</link>
<pubDate>Fri, 11 Sep 2009 17:09:47 +0000</pubDate>
<dc:creator>Brydave</dc:creator>
<guid isPermaLink="false">6440@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi everyone,&#60;/p&#62;
&#60;p&#62;I found this tutorial at wpcult.com, and am trying to implement it in my header, however I can't seem to get it to work.&#60;/p&#62;
&#60;p&#62;link to tutorial:&#60;br /&#62;
&#60;a href=&#34;http://wpcult.com/how-to-showhide-a-widget-in-wordpress-with-jquery/&#34; rel=&#34;nofollow&#34;&#62;http://wpcult.com/how-to-showhide-a-widget-in-wordpress-with-jquery/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;basically I've added a widgetized area in my header by adding it into my functions.php:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;code&#38;gt;register_sidebar(array(
       	&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;Expand Aside&#38;#39;,
       	&#38;#39;id&#38;#39; =&#38;gt; &#38;#39;expand&#38;#39;,
       	&#38;#39;before_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;li id=&#38;quot;%1$s&#38;quot; class=&#38;quot;widgetcontainer %2$s&#38;quot;&#38;gt;&#38;#39;,
       	&#38;#39;after_widget&#38;#39; =&#38;gt; &#38;quot;&#38;quot;,
		&#38;#39;before_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;h3 class=\&#38;quot;widgettitleexpand\&#38;quot;&#38;gt;&#38;quot;,
		&#38;#39;after_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;/h3&#38;gt;\n&#38;quot;,
    ));&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The widget displays fine, and I've changed the tutorial code accordingly:&#60;br /&#62;
(#expand is the div id I added to the #header)&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;script type=&#38;quot;text/javascript&#38;quot;&#38;gt;
//for toggling widgets
function toggleWidgets() {
	jQuery(&#38;#39;#expand h3.widgettitleexpand&#38;#39;).addClass(&#38;#39;plus&#38;#39;); 

	jQuery(&#38;#39;#expand h3.widgettitleexpand&#38;#39;).click(function() {
		$(this).toggleClass(&#38;#39;plus&#38;#39;).toggleClass(&#38;#39;minus&#38;#39;).next().toggle(180);
	});

} jQuery(document).ready(function() {
	toggleWidgets();
	}
&#38;lt;/script&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I don't know if it's just not using wp_enqueue_script('jquery'); or what, so any suggestions would be really appreciated since I am definitely  a jquery noob...&#60;/p&#62;
&#60;p&#62;Thanks again!
&#60;/p&#62;</description>
</item>

</channel>
</rss>
