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

Craig Watson
Courses Plus Student 27,150 PointsPlugin Specific Styles Not Registering?
Hi everyone :)
Just working on my first plugin, I had the functionality working when the code was tested in my functions.php file prior to making this into a plugin. A that point the css relevant to that function was in the main css directory.
From my main plugin.php file I added the following code hoping it would bring in the css file that is in the same plugin folder as the main plugin.php.
e.g.
-Main Plugin Folder
Plugin.php Plugin.css
<?php
function bf_button_shortcode_styles(){
wp_enqueue_style( 'bf_button_shortcode_styles', plugins_url( 'bf_button_shortcodes/bf_button_shortcodes.css' ) );
}
add_action( 'admin_head', 'bf_button_shortcode_styles' );
?>
I'm really not sure what I am getting wrong here in respect of loading the css as I have done it in the same way Zac did in the plugin vids...(I think)
Hope you can help :)
Craig

khubbaib Naeem
337 PointsNever use admin_head in backend as well.... Use admin admin_enqueue_scripts hook otherwise waring may occur...
Craig Watson
Courses Plus Student 27,150 PointsCraig Watson
Courses Plus Student 27,150 PointsFixed my own silly issue :)
admin head will style the back end :)
Craig