早上好(或晚上好),
我试图在一个自定义归档文件(taxonomy-$taxonomy.php)中合并一个double(?)查询让我们试着澄清一下:
我想显示分类法中的所有帖子。好的,它起作用了。
//start by fetching the terms for \'progression\' taxonomy $terms = get_terms( \'progression\', array( \'orderby\' => \'asc\', \'hide_empty\' => 1 ) );和查询
// Run a query for each progression foreach( $terms as $term ) { $args = array( \'post_type\' => array(\'my_custom_post\', \'another_custom_post\'), \'progression\' => $term->slug, ); $query = new WP_Query( $args ); // output the term name (here "day1", "day2"...) echo $term->name; // Start the Loop and output the titles while ( $query->have_posts() ) : $query->the_post(); the_title(); endwhile; // use reset postdata to restore original query wp_reset_postdata(); } ?>(当然,我自己没有找到这个……谢谢这个论坛!)
但(这就是问题所在)它会显示每个带有此税的帖子。然而,我想将我的请求限制在另一种分类法上。
第二项“运动”=>截击、网球、篮球。。。
就个人而言,这是可行的 但是,一旦我试图将这两个标准结合起来,我就惨败了
我可以编写代码(使用第二个查询和参数,但它不起作用,所以,它有用吗?)