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

Avery Kushner
Avery Kushner
854 Points

Can't get the styles to apply to the page

The style shows up under sources in developer tools, but doesn't apply any styles to the html.

Avery Kushner
Avery Kushner
854 Points

Here is my code:

function wptreehouse_badges_styles() {

    wp_enqueue_style( 'wptreehouse_badges_styles', plugins_url( '/wptreehouse-badges/css/wptreehouse-badges.css') );

} 

add_action( 'admin_head', 'wptreehouse_badges_styles' );

1 Answer

Sherie LaPrade
PLUS
Sherie LaPrade
Courses Plus Student 4,007 Points

The code in the video is a bit outdated, here is what my sister and I used that works:

function wptreehouse_badges_styles() {

    wp_enqueue_style( 'wptreehouse_badges_styles', plugins_url( 'wptreehouse-badges.css', __FILE__ ) );

}
add_action( 'admin_head', 'wptreehouse_badges_styles' );
Jill Ferron
Jill Ferron
5,023 Points

thanks Sherie, worked for me.