[wp-hackers] wp_enque_script and conditional tags

Jeremy Clarke jer-wphackers at simianuprising.com
Sun Jul 20 00:52:01 GMT 2008


That looks like it should work (at least the is_home() part). Are you
running extra or modified loops on your homepage? That can throw off
is_home() as well as some of the other is_ functions.

On Sat, Jul 19, 2008 at 6:54 PM, scribu <scribu at gmail.com> wrote:
> Hello! I am having a problem with conditional tags:
>
>
> add_action('init', 'js_loader');
>
> function js_loader(){
>  if ( is_home() )
>    wp_enque_script('script_name', 'script_src', array('dependencies'));
> }
>
>
> The condition in the if clause is never true. What should I change to
> enque a script only on the home page?
>
>
> scribu
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Jeremy Clarke
Code and Design | globalvoicesonline.org


More information about the wp-hackers mailing list