我自己解决了这个问题:
我所做的是:
首先创建single-football_league.php template
在此处,我放置了以下代码:
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( \'content-parts/content\', \'league\' ); ?>
<?php endwhile; ?>
第二:英寸
content-league.php
, 我放置了以下代码,它可以工作:
$terms = wp_get_post_terms( $post->ID, array(\'competition\', \'session\') );
$term_slugs = wp_list_pluck( $terms, \'slug\' );
$season = wp_get_post_terms( $post->ID, \'session\' );
$season_slugs = wp_list_pluck( $terms, \'slug\' );
$args = array(
\'post_type\' => array( \'football_fixture\' ), // profile and letter are CPTs
\'tax_query\' => array(
array(
\'taxonomy\' => \'competition\',
\'field\' => \'slug\',
\'terms\' => $term_slugs
),
array (
\'taxonomy\' => \'session\',
\'terms\' => $season_slugs,
\'field\' => \'slug\')
)
);