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 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