OOP For WordPress Archives - Ryan Kienstra

oop inheritance icon

OOP Inheritance For WordPress

By: Ryan Kienstra on: January 20, 2015  in: OOP For WordPress

OOP inheritance allows powerful, reusable code. If you haven’t already, you might read my guides: OOP Fundamentals For WordPress OOP: Instance Vs. Static Rationale: Reusing Code Programming is largely about reusing code. Functions execute the same code every time they’re called. The only difference is the arguments. But inheritance in object-oriented programming is much more […] Read more


OOP: Instance Vs. Static

By: Ryan Kienstra on: January 18, 2015  in: OOP For WordPress

By understanding instance vs. static properties, you can write flexible code. And build complex object-oriented programs. If you aren’t familiar with classes and instances, you might read OOP Fundamentals For WordPress. Properties: Instance Vs. Static Instances can store variables called instance properties. They aren’t connected to properties of other instances. But instances can also access […] Read more

OOP Fundamentals

OOP Fundamentals For WordPress

By: Ryan Kienstra on: January 11, 2015  in: OOP For WordPress

You program for WordPress using PHP functions and variables. But you’d like to use object-oriented programming. Maybe you’ve read my guide, OOP With WordPress: Why? In writing functions, you’ve already used: OOP Fundamentals Abstraction Code Reuse Abstraction Functions often have private variables. They can be abstracted from the local scope. Nothing else can access them, […] Read more

OOP With WordPress gears

OOP With WordPress: Why?

By: Ryan Kienstra on: January 9, 2015  in: OOP For WordPress

You’ve been programming with functions and variables. And most of WordPress doesn’t use OOP. So why do you need object-oriented programming? Store variables between functions Reduce arguments Show structure Plugin Example My WordPress plugin Bootstrap Widget Styling filters the markup of widgets. Here’s how to do it without object-oriented PHP: add_filter( 'wp_list_pages' , 'bws_filter_pages_widget_markup' ); […] Read more