admin管理员组文章数量:1130349
Im looking for advice to generate a few 'default' post templates. Currently this is the setup for the CPT 'projects'.
We generate subpages and select the main post type as parent. This works well to generate the needed hierarchy.
The children of the parent post category will have 5 default templates that are different.
What's the best way to create a 'template' selector for those sub pages?
Thanks a lot.
Im looking for advice to generate a few 'default' post templates. Currently this is the setup for the CPT 'projects'.
We generate subpages and select the main post type as parent. This works well to generate the needed hierarchy.
The children of the parent post category will have 5 default templates that are different.
What's the best way to create a 'template' selector for those sub pages?
Thanks a lot.
Share Improve this question edited Jun 15, 2020 at 8:21 CommunityBot 1 asked Oct 18, 2018 at 6:38 DuikbootDuikboot 1312 silver badges6 bronze badges 1- sorry, i don't get, what you are looking for, can you please clarify? you want to have a select option inside your cpt to select the template, that will be shown? – honk31 Commented Oct 18, 2018 at 14:28
1 Answer
Reset to default 0For an easy solution, you could just create page templates and set their Template Post Type to match your custom post type. WordPress has supported custom page templates for other post types than page too since version 4.7.
You can read more about it from the Theme handbook // Creating page templates for specific post types
This way you could use the native template selector that you can already see on a page's edit screen on the Page Attributes metabox.
Would this be a viable solution for you?
Im looking for advice to generate a few 'default' post templates. Currently this is the setup for the CPT 'projects'.
We generate subpages and select the main post type as parent. This works well to generate the needed hierarchy.
The children of the parent post category will have 5 default templates that are different.
What's the best way to create a 'template' selector for those sub pages?
Thanks a lot.
Im looking for advice to generate a few 'default' post templates. Currently this is the setup for the CPT 'projects'.
We generate subpages and select the main post type as parent. This works well to generate the needed hierarchy.
The children of the parent post category will have 5 default templates that are different.
What's the best way to create a 'template' selector for those sub pages?
Thanks a lot.
Share Improve this question edited Jun 15, 2020 at 8:21 CommunityBot 1 asked Oct 18, 2018 at 6:38 DuikbootDuikboot 1312 silver badges6 bronze badges 1- sorry, i don't get, what you are looking for, can you please clarify? you want to have a select option inside your cpt to select the template, that will be shown? – honk31 Commented Oct 18, 2018 at 14:28
1 Answer
Reset to default 0For an easy solution, you could just create page templates and set their Template Post Type to match your custom post type. WordPress has supported custom page templates for other post types than page too since version 4.7.
You can read more about it from the Theme handbook // Creating page templates for specific post types
This way you could use the native template selector that you can already see on a page's edit screen on the Page Attributes metabox.
Would this be a viable solution for you?
本文标签: templatesTemplating advice sub posts of a CTP
版权声明:本文标题:templates - Templating advice sub posts of a CTP 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749248293a2339262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论