简体   繁体   English

自定义帖子类型类别模板

[英]Custom Post Type Category Template

I have a custom post_type => book-site and loads of Book site categories like parent and child for eg Parent Category (All Books Sites). 我有一个自定义的post_type => book-site和大量的Book网站类别,例如父级和子级,例如Parent类别(所有Books Sites)。 Under all book sites, I have child categories: 在所有书籍网站下,我都有子类别:

All book sites 所有书籍网站
- English book sites (6 posts) -英文图书网站(6个帖子)
- German book sites (5 posts) -德语书籍网站(5个帖子)

When someone clicks the English book site, the link should show 6 posts, and 5 for German. 当有人单击英语图书网站时,链接应显示6个帖子,其中5个为德语。 If someone picks "All book sites" the parent link should show all posts for the user to click on. 如果有人选择“所有图书网站”,则父链接应显示所有帖子,以供用户单击。 How can I create this template? 如何创建此模板?

You don't need to create any template, only pass the taxonomy url. 您无需创建任何模板,只需传递分类法URL。 By default the archive.php file loads and that exactly shows the results as your requirement. 默认情况下,archive.php文件会加载,并且将结果精确显示为您的要求。

If you want to change html or any other stuff you can create template ( Archive Page) for your custom post type like archive-custom_post_type.php 如果要更改html或其他任何内容,可以为自定义帖子类型(例如archive-custom_post_type.php)创建模板(存档页面)

For more details of wordpress template hierarchy visit Template Hierarchy 有关wordpress模板层次结构的更多详细信息,请访问模板层次结构

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM