If you’ve not read the first post in this series, I recommend it, as we’re starting to get into writing object-oriented code for WordPress through the use of the Widgets API.
The series is going to capture a few things:
- show you the basic skeleton of a widget and why it’s object-oriented,
- discuss what things you should be able to notice and why
- update the Widget Boilerplate directly on this site first and then push it out to GitHub,
- build a widget using the API with the boilerplate as the foundation for our work.
But before doing that, I want to make sure that everyone reading this is caught up on the core principles of object-oriented programming and has everything needed to build out an object-oriented solution for WordPress.
To that end, I recommend the following:
- Two Pillars of Object-Oriented Programming: Part 1 of 2
- Two Pillars of Object-Oriented Programming: Part 2 of 2
- Abstract Classes, Part 1 – Abstracting Behavior
- Abstract Classes, Part 2 – Abstract Classes and Interfaces
- The Independent WordPress Developer
If you’ve read all of that content, great. You’re going to be well-prepared for this post and the upcoming posts. If not, there may be some holes in the rest of what you’re about to read, but the gist of the post should be clear enough.
What’s The Deal, Exactly?
Here’s the thing: Last week, I shared a bit of code along with some information about the Widgets API. I’m going to be revisiting that a little bit more in this post before we get into the more coding intensive part for two reasons:
- I want everyone reading this to be on the same page as it relates to writing object-oriented code (at the very least, in this context),
- I recognize that people are coming from different backgrounds and I want to make sure we’re all on the same page as much as possible before proceeding.
If you have experience with writing object-oriented code, especially in an advanced capacity, this may seem simpler to you; otherwise, I hope this is going to arm you with everything you need to detect object-oriented practices not only concerning this API but when reading others’ code, too.