Wordpress:为不同的自定义帖子类型使用自定义类别模板(category.php)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8354373/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Wordpress: use custom category template (category.php) for different custom post type
提问by Lanny
i need to customize my category.php
template depending of which custom post type the cat is attached (assuming every post type has dedicated categories, not shared between pt, and dynamically created by site admin user).
我需要category.php
根据猫所附加的自定义帖子类型来自定义我的模板(假设每个帖子类型都有专用的类别,不在 pt 之间共享,并且由站点管理员用户动态创建)。
Alternative to this can be load different template (category-slug.php?) but codex says category.php
is only and one.
对此的替代方案可以加载不同的模板(category-slug.php?),但 codex 说category.php
只有一个。
Any suggestion?
有什么建议吗?
Solved by a link provided by Vasanthan.R.P https://wordpress.stackexchange.com/questions/10099/custom-post-types-on-category-pages
由 Vasanthan.RP https://wordpress.stackexchange.com/questions/10099/custom-post-types-on-category-pages提供的链接解决
回答by Vasanthan.R.P
Try this solution.
试试这个解决方案。
http://wordpress.org/support/topic/category-template-for-custom-post-type
http://wordpress.org/support/topic/category-template-for-custom-post-type
or you can try this one too
或者你也可以试试这个
https://wordpress.stackexchange.com/questions/10099/custom-post-types-on-category-pages
https://wordpress.stackexchange.com/questions/10099/custom-post-types-on-category-pages