DevinVinson / WordPress-Plugin-Boilerplate

[WordPress] A foundation for WordPress Plugin Development that aims to provide a clear and consistent guide for building your plugins.
http://wppb.io
7.67k stars 2.25k forks source link

How should styles and scripts be enqueued? #255

Closed jolaurin closed 9 years ago

jolaurin commented 9 years ago

What would be the best way to enqueue styles and scripts contained in the plugin directory?

Example: I use the foundation framework, files are located in the CSS and JS directory of my plugin.

tommcfarlin commented 9 years ago

Take a look at this file. It shows how to do this :).

jolaurin commented 9 years ago

I'm not quite sure to understand how all this works.. I'm sorry..

jolaurin commented 9 years ago

if I copy the code I have in foundation.css to my plugin-name-admin.css it works but it kinda breaks the wordpress dashboard css...

tommcfarlin commented 9 years ago

It might be best if you wait until the documentation for the Boilerplate has been completed :). I'm in the process of creating several videos now after which I plan to begin creating a site focused exclusively on documentation.

You shouldn't need to copy anything from foundation.css into plugin-name-admin.css. Instead, you'd move foundation.css into the public/css directory and enqueue it from there - you don't want to enqueue Foundation in the Dashboard (which is why it shouldn't be in the admin directory).