Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 4, 2016 12:00 pm

Deregistering WordPress Stylesheets in 60 Seconds

There are times in which we inherit a WordPress project that's already been in use for some time. This means that we're likely dealing withsome form of legacy code, be it at the theme level or the plugin level.

Sometimes, we're able to simply upgrade the dependencies that exist in the project. Other times, we have to leave the core files but need to replace some of them with our own. To make sure our changes aren't overwritten if the customer upgrades their version of, say, the plugin in question, then we may need to deregister a script or a stylesheet in order to register our own that's located elsewhere in the project.

To do that, we can hook into the wp_enqueue_script API function and write some custom code. Here's how to do exactly that:



In the video above, example.min.css or example.css (whichever one exists) is removed from the enqueued WordPress styles.

After doing this, you should be able to hook into the same function and register your own custom styles to help improve the current state of the project.

More Details

Learn more about WordPress Development on Envato Tuts+:

What's With the 60 Seconds?

This is part of anew seriesof quick video tutorials on Tuts+. We're aiming to introduce a range of subjects, all in 60 seconds, just enough to whet your appetite. Let us know in the comments what you thought of this video and what else you'd like to see explained in 60 seconds!

Anything Else?

In the meantime, I hope this proved to be useful in helping improve your development workflow.

For more information about WordPress development, you can see all of my courses and tutorials onmy profile page, and you can follow meon my blogand/or Twitter at@tommcfarlinwhere I talk about software development in WordPress.

Please don't hesitate to leave any questions or comments in the feed below, and I'll aim to respond to each of them as time permits.


Original Link:

Share this article:    Share on Facebook
No Article Link

TutsPlus - Code

Tuts+ is a site aimed at web developers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites.

More About this Source Visit TutsPlus - Code