我有这样的情况:
/disrupt-founders/disrupt-categories/help-me-be-healthier/
我想做的是创建一个归档页面,该页面对于基于其所属自定义帖子类型的分类法来说是唯一的。这是我尝试过的,但没有成功:
taxonomy-disrupt-founder-disrupt-categories.php
我知道这会影响所有的分类法taxonomy-disrupt-categories.php
你有什么想法吗?我有这样的情况:
/disrupt-founders/disrupt-categories/help-me-be-healthier/
我想做的是创建一个归档页面,该页面对于基于其所属自定义帖子类型的分类法来说是唯一的。这是我尝试过的,但没有成功:
taxonomy-disrupt-founder-disrupt-categories.php
我知道这会影响所有的分类法taxonomy-disrupt-categories.php
你有什么想法吗?如果我知道你有一个跨多个帖子类型共享的分类法?您需要使用Wordpress的模板系统为每种帖子类型创建一个自定义模板。这是不可能的。
您可以做的是在taxonomy-disrupt-categories.php
检查当前的帖子类型,并根据帖子类型加载不同的模板部分。例如:
if(\'disrupt-founders\' == get_post_type()) {
// disrupt-founders unique template
get_template_part(\'content\', \'founders\');
} elseif(\'another-post-type\' == get_post_type()) {
// another unique template
get_template_part(\'content\', \'another\');
} else {
// default template
get_template_part(\'default\', \'default\');
}
https://developer.wordpress.org/reference/functions/get_template_part/https://developer.wordpress.org/reference/functions/get_post_type/我有主题,我添加了WooCommerce插件。但我想更改默认模板(添加侧栏,更改html…)。我可以将woocommerce模板添加到我的主题并进行编辑吗?例如my theme folder -woocommerce --templates ---single-product.php