The Beginner’s Guide to Object-Oriented Programming in WordPress

Comments are closed on this post. Please keep the discussion on each article in the series.

When it comes to writing code for WordPress, I’ve been told that I come off as someone who espouses object-oriented programming as the way to write code for WordPress.

Within theme development, that definitely isn’t true, and when it comes to plugins, it’s true only when the plugin has more than than a few functions or few moving parts that are needed to get work to done.

But one of the things that I’ve noticed in speaking with other developers is that people those who aim to start out writing object-oriented code with WordPress are kind of figuring it out as they go.

Though doing this can yield some positive results, it may also end up preventing you from learning some more of that basic techniques – or even some of the more advanced techniques – that object-oriented developers users in their day to day work.

So in my latest series on Envato, I’m working on series targeting the absolute beginner who wishes to learn object-oriented programming, and to do so within the context of WordPress.

Object Oriented Programming in WordPress

From the series itself, I share:

In theory, it sounds great especially if you know what an object is. But that’s the problem, isn’t it? We’re trying to learn about object-oriented programming, so there’s no guarantee that we even know what an object is; therefore, how can we understand that a class serves as a blueprint for it?

So in this series, I’m aiming to start at ground zero and work up to explain the concepts of object-oriented programming in WordPress.

Object-Oriented Programming in WordPress

Throughout the series, I’m going to be covering a variety of topics. So far, I’ve covered:

  1. An Introduction
  2. Classes
  3. Types
  4. Conditionals
  5. Loops
  6. Functions and Attributes
  7. Scope
  8. Building the Plugin I
  9. Building the Plugin II
  10. Document the Plugin I
  11. Document the Plugin II
  12. Inheritance I
  13. Inheritance II
  14. A Summary

From here, we’re going to continue talking about basic language constructs such as variables, access modifiers, arrays, loops, conditionals, functions, inheritance, and so on, and then we’re going to take everything that’s covered and build a plugin in order to demonstrate some of the key concepts.

Ultimately, the series will hopefully hit all of the high notes needed for those who are unfamiliar with object-oriented programming – or who are just getting started – so that they walk away better prepared to write more modular code using classes, attributes, functions, and all of the other aspects of the paradigm.