Lab Introduction
Lab: Introduction to PHP Object-Oriented Programming (OOP) for WordPress
Video Runtime: 08:27
Welcome to the Introduction to PHP OOP for WordPress lab. This is a gentle introduction to object-oriented programming. This lab starts where the typical WordPress developer is at, meaning I’ll start with procedural and help you to make the leap over into OOP.
In this lab, you’ll learn what OOP is and what it is not. You’ll be writing some code to help you see how it works.
OOP is a different mindset. It can be difficult to wrap your mind around. Therefore, you need to work with me. You’ll also need to focus on the intent and concepts. Therefore, pick a time to do this lab when you can focus uninterrupted.
Getting Your Machine Ready
At about 3 minutes into this lab, you’ll start working on getting your local machine ready to go. You’ll spin up a new test site and install a plugin that gives you Kint. You can use the Sandbox Starter plugin that you previously built, the Kint PHP Debugger plugin out of WordPress directory, or UpDevTools. I’m going to show you how easy it is to install UpDevTools.
Then you’ll create a plugin that you’ll use in this lab for testing. Here is the code for you:
<?php | |
/** | |
* OOP Sandbox Plugin | |
* | |
* @package KnowTheCode\OOPSandbox | |
* @author hellofromTonya | |
* @license GPL-2.0+ | |
* | |
* @wordpress-plugin | |
* Plugin Name: OOP Sandbox Plugin | |
* Plugin URI: https://KnowTheCode.io | |
* Description: OOP Sandbox test plugin | |
* Version: 1.0.0 | |
* Author: hellofromTonya | |
* Author URI: https://KnowTheCode.io | |
* Text Domain: journals | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt | |
*/ | |
namespace KnowTheCode\OOPSandbox; | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit( 'Cheatin’ uh?' ); | |
} |
If you require additional help on setting up your machine, check out this article in the Help Center for what is needed.
When was the last time you got out of your chair and stretched? Just saying…
Episodes
Total Lab Runtime: 03:04:55
- 1 Lab Introductionfree 08:27
- 2 What is Object-Oriented Programming (OOP)?free 14:14
- 3 What is an object?free 13:30
- 4 Meet the Class Blueprintpro 04:53
- 5 Creating an Objectpro 07:57
- 6 Defining Characteristicspro 10:54
- 7 Putting the Object to Workpro 13:56
- 8 Hiding Away the Complexitypro 22:40
- 9 Working within the Object with $thispro 15:41
- 10 Internal Control of Object Creationpro 15:07
- 11 Class Constantspro 08:58
- 12 Class Staticpro 17:49
- 13 What OOP is Notpro 19:11
- 14 Practical Examplespro 04:52
- 15 Wrap it Uppro 06:46