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

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!