From the course: WordPress: Action and Filter Hooks

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Applying filters for loading style sheets

Applying filters for loading style sheets - WordPress Tutorial

From the course: WordPress: Action and Filter Hooks

Start my 1-month free trial

Applying filters for loading style sheets

- [Instructor] Earlier in the course, we created a custom stylesheet for our plugin and we came in and hooked it using this wp_enqueue_scripts hook. That's a nice thing to do because you're adding some basic starter styles for whatever content you're making visible to users, but it's possible to go overboard. I've seen some plugins where developers get highly opinionated about applying styles, which makes it difficult down the road if you wanted to overwrite those styles. So if you do add styles with your plugin, you'll want to be judicious in how you apply those styles so that another developer could easily override them in the future. Now, if you really wanted to be nice, you could easily provide a way for a developer to come in and disable your styles all together. And I'm going to show you how to do that. So I'm going to come back here to this function, spc_load_stylesheet, and I'm going to add a conditional…

Contents