<?php
$categories = array(\'economy\',\'the-constitution\',\'monetary-policy\',\'liberty\');
foreach($categories as $category) {
$args = array(
\'posts_per_page\' => 1,
\'category_name\' => $category,
\'tax_query\' => array(
array(
\'taxonomy\' => \'highlight\',
\'field\' => \'slug\',
\'terms\' => array( \'lead\',\'featured\' ),
\'operator\' => \'NOT IN\'
)
)
);
$wpse42358_query = new WP_Query( $args );
while( $wpse42358_query->have_posts() ) : $wpse42358_query->the_post();
// write post stuff here
wp_reset_postdata();
}
?>
我选择使用WP\\u查询,因为您可以更好地控制分类查询。