简体   繁体   中英

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). Under all book sites, I have child categories:

All book sites
- English book sites (6 posts)
- German book sites (5 posts)

When someone clicks the English book site, the link should show 6 posts, and 5 for German. 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. By default the archive.php file loads and that exactly shows the results as your requirement.

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

For more details of wordpress template hierarchy visit Template Hierarchy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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