我有贴子类型“product”和层次分类“types”。在这个分类法中,我有“干洗”、“洗衣机”等术语,每个术语上有几个子术语。
在我的情况下,我需要显示,例如:
- http://example.com/types/washer -> 显示其上的所有子项http://example.com/types/washer/{子项}->显示所有帖子
My questions is:
<如何获取父术语的永久链接URL?我尝试上面的URL,但结果是404 - 是
taxonomy-types-washer.php
是否足以满足第1种情况?或者我应该创建taxonomy-types.php
在那里创造逻辑template hierarchy, 我可能需要taxonomy-types-{term_parent}.php
列出所有子条款和taxonomy-types.php
以子术语列出所有产品single-product.phparchive-{posttype}.php 当我没有任何帖子的时候,它就不起作用了。有什么解决办法吗?(我应该提出不同的问题,还是坚持这个问题?)
UPDATE
我检查了我的rewrite_rules
选项,它根本不列出[类型]。我不知道为什么。为了测试它,我把子弹换成product-types
, 刷新permalink并列出以下内容:[product-types/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?types=$matches[1]&feed=$matches[2]
[product-types/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?types=$matches[1]&feed=$matches[2]
[product-types/([^/]+)/page/?([0-9]{1,})/?$] => index.php?types=$matches[1]&paged=$matches[2]
[product-types/([^/]+)/?$] => index.php?types=$matches[1]
所以我想现在已经注册了。我尝试加载URLproduct-types/washer
转到404。我尝试加载URLindex.php?types=washer
. 它也是404。现在,我有以下文件:分类类型垫圈。php分类类型。所以,我不知道这个有什么问题:(。
UPDATE #2
我发现了问题所在。因为我错过了\'rewrite\'=>array(\'hierarchical\'=>true)
这是新的rewrite_rules
:
[product-types/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?types=$matches[1]&feed=$matches[2]
[product-types/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?types=$matches[1]&feed=$matches[2]
[product-types/(.+?)/page/?([0-9]{1,})/?$] => index.php?types=$matches[1]&paged=$matches[2]
[product-types/(.+?)/?$] => index.php?types=$matches[1]