我有一个自定义的帖子类型,服务提供者,有两个分类法,区域和服务。我想根据分类法制作一个模板。
function template_taxonomy($template) {
if (is_archive()) {
if ((is_tax(\'service\') and is_tax(\'area\')) or is_tax(\'service\')) {
$template = locate_template( array( \'taxonomy_service.php\' ) );
} else if (is_tax(\'area\') and !(is_tax(\'service\'))) {
$template = locate_template( array( \'taxonomy_area.php\' ) );
}
}
return $template;
}
代码非常简单,但我的问题是,当我尝试访问此URL时http://www.site.com/?service-provider&service=electricians&area=north-shore-lower
服务分类法似乎不存在,因此它使用taxonomy\\u区域。php模板。还尝试只使用taxonomy\\u服务。php模板上似乎也不存在区域分类法。有什么想法吗?