[wp-hackers] wp_enque_script and conditional tags

DD32 wordpress at dd32.id.au
Sun Jul 20 11:14:06 GMT 2008


By the sound of it, The Query object hasnt been setup at the point that  
init hook is run.

Try hooking later, say onto template_redirect

On Sun, 20 Jul 2008 20:54:42 +1000, scribu <scribu at gmail.com> wrote:

> @Austin Matzko: No, i didn't misspell it, because it works without  
> is_home().
>
> @Andy: I have tried it on a fresh install, with a single active plugin
> that had this code:
>
>
> add_action('init', 'js_loader');
>
> function js_loader(){
>
> 	if ( is_category() )
>
> 		wp_enqueue_script('jquery');
> }
>
>
> If I remove the if condition, it works fine.
>
> On Sun, Jul 20, 2008 at 5:58 AM, Andy Skelton <skeltoac at gmail.com> wrote:
>>>  if ( is_home() )
>>
>> That will be false if you are testing it on a static front page. Test
>> is_front_page() if you are using a static front page.
>>
>> Andy
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> http://scribu.net
> _______________________________________________
> 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