This entry is part 10 of 14 in the Plugin Development 101 Series
- Introduction to WordPress Plugin Development 101
- Plugin Development 101 – What Makes a Plugin?
- Plugin Development 101 – General Best Practices
- Plugin Development 101 – An Intro to Filters
- Plugin Development 101 – Intro to Actions
- Plugin Development 101 – Registering a Custom Post Type
- Plugin Development 101 – Intro to Short Codes
- Plugin Development 101 – Intro to Loading Scripts and Styles
- Plugin Development 101 – Introduction to Adding Dashboard Menus
- Plugin Development 101 – Separating Your Plugin into Multiple Files
- Plugin Development 101 – Your First OOP Plugin
- Plugin Development 101 – Dissecting the Featured Comments Plugin
- Plugin Development 101 – Digging Into WordPress Core to Solve a Problem
- Plugin Development 101 – Introduction to extending classes
In part 3 we discussed the general best practice of separating your plugin out into multiple files. Today we’re going to look at how you actually do that and also go into more depth about why this is a good practice that you should be adopting for all of your plugins once they begin to become even remotely complex.
By separating your plugin into multiple files, you immediately make the entire plugin easier to manage, debug, and understand, especially for other developers that may not be intimately familiar with your code base.
This video walks you through many of reasons we separate our plugins into multiple files and how to do it. It also discusses being a responsible developer by localizing where your files are loaded, meaning files are only loaded when they are needed.
Hi Pippin,
I’ve been following along with this series but can’t get this video or the next one to play, all the others in the series seem to work fine?
Thanks
Andrew
My embedded video player has been having trouble. I’ve been working on getting the videos all moved over to Vimeo. This one should be moved by Monday.
Thanks Pippins that’s great 🙂
The video has been moved to Vimeo and should be live withing 15 minutes.
Thanks Pippin, any chance of doing the next video too at some point as that seems the same 🙂
Working on it now!
Thanks Pippin 😉
🙂
Finished!
Hi Pippin,
Really enjoying this series. Quick question. How far do you take the conditional loading of scripts/styles concept? For example, if you have a plugin with a dozen or so shortcodes and you don’t know where they will be used, should you do check for each one and only load the scripts if it is used?
Also, in this case, should you separate your Javascript and CSS for each shortcode into multiple files and load them conditionally? Or is that overkill?
Dear Pippin,
The video quality is too bad to see the codes it can be hard to see if you use “[]” or “()” and when wordpress codex is rather difficult for a beginner to read it makes it very hard . wordpress codex changed since you made your videos. so it is quite impossible to find the same as you, shown in your videos. This together makes it extremely difficult to get the most out of your videos
sorry I found the problem, it’s not your problem
Glad to hear you can see it better now!
There’s no videos in most of the pages, is that intentional?