<?php
$args = array(
\'posts_per_page\' => -1,
\'cat\' => 7,
\'orderby\' => \'post_date\',
\'order\' => \'DESC\',
\'post_type\' => \'post\',
\'post_status\' => array(\'publish\', \'draft\', \'pending\' ),
\'author\' => 1,
);
$postslist = get_posts( $args );
foreach ( $postslist as $post ) :
setup_postdata( $post ); ?>
<div>
<?php the_date(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
</div>
<?php
endforeach;
wp_reset_postdata();
?>
将类别id替换为“cat”,将作者id替换为“author”,然后进行检查。参考:
http://codex.wordpress.org/Class_Reference/WP_Query