我希望archives.php
能够一次显示多个自定义分类。
现在,如果我写
,这是有效的domain.com/?taxonomy=red&taxonomy2=circle
或
domain.com/?taxonomy=red+blue
但是,如何使我的分类法列表正确链接到此?现在我只能获得domain.com/?taxonomy=red
而不能在URL中添加任何其他内容。
archives.php上的侧栏包含以下代码:
<?php
//First Query for Posts matching term1
$custom_terms = get_terms('taxonomy');
foreach($custom_terms as $custom_term) {
wp_reset_query();
$args = array('post_type' => 'taxonomy',
'tax_query' => array(
array(
'taxonomy' => 'taxonomy',
'field' => 'slug',
'terms' => $custom_term->slug,
'orderby' => 'title'
),
),
);
$loop = new WP_Query($args);
if($loop->have_posts()) {
echo '<li><a href="'.get_term_link( $custom_term, $taxonomy ).'">'.$custom_term- >name.'</a>';
echo '</li>';
}
}
?>