Mastering WP_Query: Properties and Methods
read more
Categories

Mastering WP_Query: Properties and Methods


Welcome to yet another part of our “Mastering WP_Query” series. How are we doing so far? I hope you’re enjoying these tutorials as much as we’re enjoying writing them.

In this tutorial, you’re going to learn about the properties and methods of the WP_Query class. But first, I think it’s appropriate to talk about what “properties” and “methods” are in a class.

Shall we?

What Are Properties and Methods, Exactly?

In PHP, there’s a way to write code in a cleaner way: object-oriented programming, or OOP. With OOP, we use “classes” as blueprints—I took the term from one of the classic posts of Code Tuts+, “Object-Oriented PHP for Beginners” by Jason Lengstorf:

A class, for example, is like a blueprint for a house. It defines the shape of the house on paper, with relationships between the different parts of the house clearly defined and planned out, even though the house doesn’t exist.