Can't access things inside of WP_Query Object
Here's what I'm seeing when I do a var_dump on a new WP_Query
I create:
object(WP_Query)#115 (45) {
["query_vars"]=>
array(55) {
["post_type"]=>
string(6) "charity"
["order"]=>
string(3) "ASC"
["error"]=>
string(0) ""
["m"]=>
int(0)
["p"]=>
int(0)
["post_parent"]=>
string(0) ""
["subpost"]=>
string(0) ""
... and so on ...
}
}
The code I used to create it is as follows:
$charity = new WP_Query(array(
'post_type' => 'charity',
'order' => 'ASC'
)开发者_Go百科);
I've tried to do so many variation of <?php echo $charity[INSERTSOMETHINGHERE']; ?>
and nothing shows up. I don't use PHP much, but my client insists on a WordPress site. How would I access something like, for say, the post_type
in that Object?
Thank you!
$charity->query_vars['post_type']
精彩评论