好吧,这很复杂:-)你考虑过使用rewrite endpoints?
我不会尝试将所有内容都塞进url,除非您有特定的需要或要求。
domain/<series>/<episode-name>
直接去看CPT
domain/cartoon-series/<series>
- 将进行系列CPT
然后使用“重写端点”为这些URL提供功能:
domain/cartoon-series/<series>/gallery
domain/cartoon-series/<series>/description
您可以添加类似的内容以允许这些(/gallery和/description)端点:
function add_endpoints() {
add_rewrite_endpoint(\'gallery\', EP_PERMALINK);
add_rewrite_endpoint(\'description\', EP_PERMALINK );
}
add_action( \'init\', \'add_endpoints\', 0);
并且有代码来处理卡通系列的默认CPT模板中的端点。
另一种方法是执行您已经考虑过的操作,即将卡通系列设置为分类法,然后使用重写端点并在类别中解析它们。php文件?
我希望这对你有所帮助。
**另一种选择
不要为卡通系列创建CPT。将其作为一个类别,可用于插曲CPT和专题CPT:
Categories
Series
Series1
Series2
Series3
Episode CPT
Special Features CPT
domain/cartoon-series/<series>
- 显示类别页面(将列出插曲CPT和特色CPT)以及pulldomain/cartoon-series/<series>/episodes
- 类别页面只列出了插曲CPT(其中“插曲”是重写端点)domain/cartoon-series/<series>/features
- 列出功能CPT的类别页面(其中“功能”是重写端点)
上述内容将根据类别中的逻辑进行呈现。phpThen公司
情节CPT将映射到/情节/特征CPT映射到/特征/
问题在于如何使其发挥作用:
域/卡通系列//集/-显示集CPT域/卡通系列//功能/-显示功能CPT
当然,你也需要以某种方式获取该系列的信息。