Php 档案中的多种分类法
我希望Php 档案中的多种分类法,php,archive,taxonomy,Php,Archive,Taxonomy,我希望archives.php能够同时显示多个自定义分类法 现在,如果我写了 domain.com/?taxonomy=red&taxonomy2=circle 或 但是我如何使我的分类列表正确地链接到这一点呢?现在我只能获取domain.com/?taxonomy=red,而不能向URL添加任何其他内容 archives.php上的侧栏包含以下代码: <?php //First Query for Posts matching term1 $custom_terms = ge
archives.php
能够同时显示多个自定义分类法
现在,如果我写了
domain.com/?taxonomy=red&taxonomy2=circle
或
但是我如何使我的分类列表正确地链接到这一点呢?现在我只能获取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>';
}
}
?>
请包含您正在引用的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>';
}
}
?>