<?php
// Set the args
$args = array(
\'tax_query\' => array(
\'post_type\' => \'show\',
\'relation\' => \'AND\',
array (
\'taxonomy\' => \'location\',
\'field\' => \'slug\',
\'terms\' => \'california\',
),
array(
\'taxonomy\' => \'genre\',
\'field\' => \'slug\',
\'terms\' => \'comedy\',
)
)
);
// Make a new instance of WP_Query
$query = new WP_Query($args);
// Make the query
$query->query(\'showposts=5\');
// Test for posts
if($query->have_posts())
{
// Loop through posts
while($query->have_posts())
{
echo \'<div>\';
the_title();
echo \'</div>\';
// Set up the post
$query->the_post();
global $post;
}
}
?>
但问题是它显示的帖子也来自帖子
结果:有点像《喜剧》(Carifornia,喜剧)的帖子,而其他帖子则是从1类帖子到2类帖子