Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress How to Build a WordPress Theme Preparing to Code WordPress Templates Linking CSS

Nontawat Limpi
Nontawat Limpi
4,009 Points

wp_register_style Not working :(

I do follow this vdo but flexslider not show in source code . i think it problem on -> if statement in is_page ( ' home ' )

This is my Code

"

wp_register_style('flexslider', get_template_directory_uri() . /css/flexslider.css') ;

if( is_page( 'home' )){ wp_enqueue_style('flexslider'); }

"

and i change " is_page( ' about ' ) " it still no work

thanks . sorry for weak eng

3 Answers

Try it this way:

wp_register_style( 'flexslider' , get_template_directory_uri( ) . '/css/flexslider.css') ;

if( is_page( 'home' ))
{
   wp_enqueue_style( 'flexslider' ); 
}
Nontawat Limpi
Nontawat Limpi
4,009 Points

it same my code . it still not work

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Try:

if( is_front_page()  )
{
   wp_enqueue_style( 'flexslider' ); 
}