课程: PHP for WordPress (2020)

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

WP_Query

WP_Query

- [Instructor] When you're ready to create your own template and get more or different data from the WordPress database, there's really only one right way to do it, and that's WP Query. WP_query is a class, a concept you likely haven't been introduced to yet, but you can think of a class as a blueprint for objects. A class is a code definition or template for creating objects, and objects are a group of variables and functions marked by a single identifier. The powerful part of objects is that you can have more than one as long as you name them differently. So for example, if we have a person class, then we can create two person objects. Perhaps the person class replaces the array that you saw earlier where we defined a name, an age, and a profession. Instead of having an array of all that information, I can create a new person object that we can call Joe, and I can my name and age to it. Similarly I can create a new…

内容