[wp-hackers] Re: wp_enqueue_script Question

Otto otto at ottodestruct.com
Thu Mar 27 16:39:49 GMT 2008


That works because you're just calling wp_enqueue_script('jquery').
The add_action at that point is meaningless.

add_action takes two string parameters. The first one is the action
name. But the second one is the name of the function to call. In this
case, you're actually calling wp_enqueue_script('jquery'), and it
returns false/null/zero/nothing, which you then pass to the add_action
function.

So no, your code is wrong. Simply using wp_enqueue_script('jquery');
at that position would have the same effect.


On Thu, Mar 27, 2008 at 11:34 AM, sunburntkamel <sunburntkamel at gmail.com> wrote:
> I'm not sure that's correct - I've always used:
>
>  add_action('wp_head',  wp_enqueue_script('jquery') );
>
>  Which _just works_.  Putting it inside a function (as Austin did)
>  never works for me.
>
>  On Mar 27, 8:01 am, "Austin Matzko" <if.webs... at gmail.com> wrote:
>
> > On Thu, Mar 27, 2008 at 8:58 AM, Chris Poteet <cpot... at siolon.com> wrote:
>  > > I have this.  It adds the css but not the jquery.  What am I doing
>  > >  wrong (please)?
>  >
>  > >  function postinfo_head() {
>  > >         wp_enqueue_script( 'jquery' );
>  > >         echo "<link href=\"". get_bloginfo('wpurl'). "/wp-content/plugins/
>  > >  post-information/post-information.css\" type=\"text/css\" rel=
>  > >  \"stylesheet\" media=\"screen\" />";
>  > >  }
>  >
>  > >  add_action('wp_head', 'postinfo_head');
>  >
>  > "wp_head" is too late for queuing; you need to do it earlier, perhaps at "init."
>  > _______________________________________________
>  > wp-hackers mailing list
>  > wp-hack... at lists.automattic.comhttp://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
> _______________________________________________
>  wp-hackers mailing list
>  wp-hackers at lists.automattic.com
>  http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list