当方框状态更改时,使用javascript提交表单。然后,可以使用wp\\u query创建新查询,并使用tax\\u query显示选中的分类:
$args = array(
... // posttype and such
\'tax_query\' => array(),
...// other arguments
);
//if post is set
if(isset($_POST[\'cats\'])){
//pusch to array
$args[\'tax_query\'][] = array(
\'taxonomy\' => \'the taxonomy\',
\'field\' => \'id\', // get tax by id or slug
\'terms\' => $_POST[\'cats\'],
\'operator\' => \'AND\' // or you can choose \'IN\'
);
}
$new_query = new Wp_Query($args);
//start loop
while ($new_query->have_posts() ) : $new_query->the_post(); ?>
希望有帮助。