你不应该使用query_posts()
这里,但是WP_Query()
. (在WPSE中搜索query_posts
如果你想知道wy。)
<?php
$custom_query_args = array(
\'post_type\' => \'page\',
\'post_parent\' => \'50\',
\'post_status\' => \'publish\',
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\',
\'posts_per_page\' => \'100\'
);
$custom_query = new WP_Query( $custom_query_args );
// To see the contents of the $custom_query object
var_dump( $custom_query );
?>
编辑无骰子。相同的结果。
查询返回的正是它要返回的内容。为了访问$post
数据,您需要set up the Loop:
if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post() );
// The $post variable is now available,
// so you can access the post content, either as
// $post->post_content or as the_content()
endwhile; endif;
所以,我猜你的问题是你没有设置循环。