Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Caio Ferrari
Caio Ferrari
5,455 Points

Linking CSS to internal pages

The Linking CSS taught us about how to link a CSS file to our page and, moreover, showed how display a single CSS file in a particular page. In the video case, that was using the if statement with the is_page condition set to "home". However, I'd like to figure out how to link to another pages.

For example: I have my products.php page template that I want to set my dropdown stylesheet. Am I supposed to do this?

wp_register_style( 'dropdown', get_template_directory_uri() . '/css/dropdown.css' )
  if( is_page( 'products' ) ) {
    wp_enqueue_style( 'dropdown' );

Sadly, it is not working!

Could you guys please help me out?

Thx pretty much!