感谢Chip Bennett告诉我使用query_posts
内部内容。所以我用get_posts
我得到了我想要的,谢谢!
如果你和我有同样的问题,下面是你如何做到这一点的示例:
function some_name(){
global $post;
$tmp_post = $post;
$args = array( \'post_type\'=>\'page\', \'numberposts\' => -1, \'orderby\'=> \'title\', \'order\' => \'ASC\' );
$myposts = get_posts( $args );
if ( !empty($myposts) ) {
foreach( $myposts as $post ) : setup_postdata($post);
the_title();
echo \'<br>\';
endforeach;
}
$post = $tmp_post;
}