Congratulations! You did it! You built a custom, from scratch meta box for a common task of providing a subtitle for your client. Looking back at the code, there’s a lot of boilerplate logic. That means with a few lines of code you were able to create a custom implementation.
Notice that we hard-coded in the configuration information. That means we have an opportunity to create a reusable boilerplate and meta box generator function, that you can use on every project. We’ll do that in the next lab.
Considering the Impact of 3rd Party Plugins on Your Client
I want to point out to you that you can build your own meta box without a 3rd party plugin. Why? Because meta box plugins are for you, the developer, and not the site owner and those managing the content on the website after you deliver the project. Those exist to make your job easier.
What is that important? Because you are making your client’s website dependent forever on a 3rd party plugin. That plugin is bloated as it needs to handle all the different combinations of different meta box configurations. With a few lines of code, you could eliminate the dependency and unused and bloated code for your client.
These are decisions that developers need to make every day, weighing out the dependencies we place on our clients verses the benefits throughout the software’s lifecycle.
Don’t repeat yourself. Don’t repeat yourself. Don’t repeat yourself.
Total Lab Runtime: 02:21:18
- 1 Lab Introductionfree 07:20
- 2 What is a Meta Box?free 07:28
- 3 Add a New Meta Boxpro 11:46
- 4 Meta Box HTMLpro 18:39
- 5 Save Process & $_POSTfree 12:33
- 6 Bail Out if Not Our Meta Boxpro 05:03
- 7 Nonce Security Checkpro 10:16
- 8 On Save - Update or Delete Custom Field?pro 12:03
- 9 Validate & Sanitize BEFORE Updating Databasefree 14:41
- 10 Add Another Custom Fieldpro 08:49
- 11 Making Save Easier with $_POST Keypro 05:32
- 12 Better Saving Strategy for Multiple Custom Fieldspro 14:47
- 13 Changing Where Meta Box Appearspro 06:02
- 14 Passing Arguments to Renderpro 02:18
- 15 Wrap & Making it Reusablepro 04:01