只需将此添加到循环上方
$args = array(
\'posts_per_page\' => 10,
\'category__in\' => array( 2, 6 ), //change and add the category ids here
\'orderby\' => \'date\',
\'order\' => \'ASC\')
query_posts($args);
您可以阅读有关query\\u posts参数的更多信息
http://codex.wordpress.org/Function_Reference/WP_Query#Parameters按流行需求更新:)下面是另一个使用tax\\u查询执行相同操作的示例
$args = array(
\'tax_query\' => array(
array(
\'taxonomy\' => \'category\',
\'field\' => \'slug\',
\'terms\' => array(\'category1\',\'category2\') ////change and add the category slugs here
)
)
\'posts_per_page\' => 10,
\'orderby\' => \'date\',
\'order\' => \'ASC\')
query_posts($args);