Object-Oriented PHP for WordPress Developers

object-oriented dog example

Welcome to our free course on object-oriented PHP (OOPHP) for WordPress. This course explains the following:

  • The object-oriented paradigm in software development, and its strengths and weaknesses relative to other paradigms,
  • The core concepts of object-oriented programming in PHP with code examples,
  • A few advanced topics in OOPHP that are especially useful in WordPress development, and
  • How object-oriented code can best fit into the broader WordPress software system.

After the main course content, we link you to our courses on the two most important object-oriented systems in WordPress: WP_Query and the Widgets API.

Before we dive in: If you’re serious about mastering WordPress as a software system, check out our flagship “learn WordPress development” course, Up and Running:

The Best Way to Learn WordPress Development

Get Up and Running Today

Up and Running is our complete “learn WordPress development” course. Now in its updated and expanded Third Edition, it’s helped hundreds of happy buyers learn WordPress development the fast, smart, and thorough way.

Here’s what they have to say:

“I think anyone interested in learning WordPress development NEEDS this course. Watching the videos was like a bunch of lights being turned on.” -Jason, WordPress developer

“Other courses I’ve tried nearly always lack clear explanations for why WordPress does things a certain way, or how things work together. Up and Running does all of this, and everything is explained clearly and in easy-to-understand language.” -Caroline, WordPress freelancer

Enjoy this free course on OOPHP!

1. Object-Oriented Programming as a Software Paradigm

What is object-oriented programming at a conceptual level? Why is it better (or worse) than its alternatives? Start here for a comparison of OOP with both procedural and functional programming.

The Three Development Paradigms: Procedural, Object-Oriented, and Functional

2. Introduction to Object-Oriented PHP

Object-oriented programming revolves around two fundamental concepts: classes and objects. Learn what those concepts mean and how they interact, with code examples, in this core introduction to OOPHP.

Introduction to Object-Oriented PHP for WordPress Developers

3. Understanding Class Inheritance in PHP

Class inheritance (child and parent classes) is a core feature of object-oriented programming. Learn how class inheritance functions in OOPHP, with clear code examples.

WP_Query: Understand it, Love it!

4. The __construct() Magic Method

In OOPHP, a class’s __construct() method will run anytime an object of that class is instantiated. Learn how __construct() works and what it’s good for.

WP_Query: Understand it, Love it!

5. How to Combine Object-Oriented Code with WordPress’s Hooks System

This article takes a practical look at one of the most immediate questions writing object-oriented code for WordPress: How should classes and objects interact with WordPress’s event-driven hooks system?

Where and How to Use WordPress Hooks in Objects

6. Introduction to Static Methods

Static methods are a somewhat advanced topic in object-oriented PHP that’s helpful to understand. This article introduces the topic and gives a simple code example.

PHP Static Methods in Depth: What They Are & How they Work in WordPress

Further Reading

Now that you understand the fundamentals of object-oriented programming in PHP, you’re more than ready to encounter WordPress’s two most important object-oriented systems: the Widgets API and WP_Query.

Creating WordPress Widgets: The Complete Guide

WP_Query: Understand it, Love it!

Lastly, knowing how to combine object-oriented code with WordPress’s hooks system is most helpful for custom plugins you’ll design yourself—so if you haven’t dipped your toe into plugin development, now’s the time. Here’s a free Crowdcast video we recorded that walks you through writing a plugin from scratch.

Thanks for reading! As always, we’d love to hear any thoughts questions in the comments below, or in our Facebook group.

Add a Comment

Your email address will not be published. Required fields are marked *