Want to build custom Genesis themes professionally? Then this is the series for you. You and Tonya will dive deep into the entire process of building a real world, fully-functional, custom Genesis child theme from scratch. You’ll learn deeply about the framework, WordPress, PHP, HTML, CSS, and more as you build this theme.
Labs
Labs are hands-on coding projects that you build along with Tonya as she explains the code, concepts, and thought processes behind it. You can use the labs to further your code knowledge or to use right in your projects. Each lab ties into the Docx to ensure you have the information you need.
Each lab is designed to further your understanding and mastery of code. You learn more about how to think about its construction, quality, maintainability, programmatic and logical thought, and problem-solving. While you may be building a specific thing, Tonya presents the why of it to make it adaptable far beyond that specific implementation, thereby giving you the means to make it your own, in any context.
PHP OOP and WordPress Hooks Basics
Registering and unregistering WordPress hook callbacks is different with PHP objects. In this hands-on lab, you’ll learn the syntax, why it’s different, how to register and unregister, as well as strategies to work with other plugins.
Wrap. Where to go next?
Let’s review what you learned in this lab. Then I’ll give you some resources to continue learning about OOP. Congratulations for completing this lab! Other PHP Resources A collection of other awesome educational resources. Want to really level up in PHP? Make sure you also join PHP Nomad. Leading PHP developers share their insights with you each month. Their libraries are filled with PHP awesomeness. If you are a member, they have a deal waiting for you….3 months for FREE! Object-Oriented Bootcamp in PHP – Laracasts Jeffrey Way at Laracasts has an awesome Object-Oriented Bootcamp. If you get a chance, […]
Practical Examples
Here are some practical examples of WordPress plugins that are well architected and built to clean coding standards: WordPress Custom Menu Separator by Tom McFarlin Single Post Meta Manager by Tom McFarlin Settings Page – Better Implementation by Alain Schlesser Tag Swapper by Tonya Fulcrum by Tonya Laravel’s Illuminate codebase is a beautifully crafted example of OOP and clean, quality coding. It’s more advanced, but well worth a tour through the code to see how wonderful OOP can be. Symfony is another well-crafted and architected codebase. Like Laravel, it’s both OOP and clean coding.
Class Constants
There are times when you need have some constant value, such as a version. PHP gives the means to declare a constant on the class blueprint using const VERSION. What is a constant? It’s a special variable that you declare and set just once. It’s not changeable. In this episode, you’ll learn how to declare, what it is, why you want, and when to use it. You’ll see how to use it within the class and application. You’ll learn about the difference between $this and self::.
What OOP is Not
Let’s talk about OOP is not. When you look at different plugins in WordPress, you’ll see a common pattern of class blueprint with all static properties and methods. That is not OOP. Why? You can’t create an object from statics. Statics don’t know anything about objects, as they belong to the class. This episode will show you why this matters. The design approach of wrapping static functions and properties within a class is called Class Wrapper. It’s a design pattern that utilizes the class’ ability to hide complexity. When used for that purpose, it can add helper functionality to your […]
Class Static
In PHP, a class can have static properties and methods. A static is bound to the class blueprint and not the object or any of the objects. Therefore, all of the objects share the static code. If the class has a static property, then any object that changes that property is reflected and changed for every single object of that class. This is a very important episode. Make sure you watch it at least once. This episode will help you to cement the different of statics and objects. You access the static with a double colon ::. Within the class, […]
Internal Control of Object Creation
When you create a new object, i.e. instantiate it with the keyword new, PHP gives you a constructor. You can use this constructor to control what happens when the object is created. Why would you want to do that? An object should be created in a known starting state. This approach makes sure the object is ready to use. You pass in the starting information and then let the object initialize itself. You can let it setup and set the properties as well as run the initialization processes. The other reason is that the implementation, i.e. the external application code […]
Working within the Object with $this
This episode covers a hard topic for most OOP newbies to grasp: the concept of accessing an object’s internal properties and methods using the PHP reserved pseudo-variable $this. Each object uses the class blueprint as its code. Within the object itself, you reference that object’s properties and methods using $this. For example, let’s say you wanted to check the first name on a User object. You would do: $this->first_name within the object itself. Look at that code. Internally within the object, the variable $this refers to the object that you are working with. It’s just that one object and not […]
Hiding Away the Complexity
Part of OOP is the ability to hide away complexity from the outside world. The object controls the sequence for the work to be done. It only exposes what it is needed for the application to work with the object. For example, let’s relate this difficult concept to a car. When you start your car, the car handles all the tasks to start the car. It handles the air and gas mixtures, pistons, spark plugs, and circuits. You don’t have to manually sequence through each of those tasks yourself to start that car. No, you just push the button or […]