From the course: PHP for WordPress
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
WP_Query
- Truth be told, the block editor and specifically the query loop block, has made it easier to get more customized data from your WordPress database without the need for code. But, in my experience, it's still pretty limited. When you're ready to create your own templates and get more or different data from the WordPress database, there's really one right way to do it. WP Query. WP Query is a class. A concept you likely haven't been introduced to yet. You can think of a class as a blueprint for objects. An object is a way of grouping variables and functions together. The powerful part of objects is you can have more than one as long as you name them differently. So if you have a person class, you can use it to create two person objects. Joe and Phil. They'll have the same variables and functions available to them, but the information will be different. You can see in this example, Joe is a person object with the name Joe Casabona and the age 39. Where Phil is a person object with the…
Contents
-
-
-
-
-
-
(Locked)
The functions file2m 53s
-
(Locked)
Copying Hello Dolly5m 3s
-
(Locked)
WP_Query4m 10s
-
(Locked)
Hooks, actions, and filters4m 41s
-
(Locked)
PHP in the Block Editor1m 29s
-
(Locked)
Theme development in the age of the Block Editor3m 3s
-
(Locked)
Creating a plugin10m 56s
-
(Locked)
Is PHP enough?1m 42s
-
(Locked)
-