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?