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 Plugin Building a WordPress Plugin Settings Page Adding CSS to WordPress Plugin Settings Pages

Lan Mi
Lan Mi
2,570 Points

Can't enqueue the style sheet. Why?

I added the below code as described in the video to my local wp test site, however, the styles do not show up. Why? Any help? Thank you

function wptreehouse_badges_styles() { wp_enqueue_style('wptreehouse_badges_styles',plugins_url('wptreehouse_badges/wptreehouse_badges.css')); }

add_action('admin_head','wptreehouse_badges_styles');

2 Answers

Andrew McCormick
Andrew McCormick
17,730 Points

this may sound obvious, but are you sure your css file is copied into the correct location on your localserver?

Lan Mi
Lan Mi
2,570 Points

Thank you Andrew. I put wptreehouse_badges.css file under this folder on the localserver. ..wp-content\plugins\wptreehouse-badges