Joy
(@joyously)
You shouldn’t need to. Rename your template to single-therapist.php
See the Template Hierarchy.
Thanks Joy – does it matter that I want to load a Page Temple, not a Post template?
I would like to be able to use my Page Builder plugin for the Therapist content data.
Joy
(@joyously)
The page template dropdown is stored as a post meta field. The content is the name of the template, so it is theme specific, as are any other template files. If there is no value (no post meta field), then you get the default template according to the template hierarchy (which of course is theme specific because there may or may not be a template for the custom post type).
Really, if you have a custom post type, you should have a plugin to handle it, but I can see how you can use generic plugins to build what you want. This is the same for using the template hierarchy to pull in the correct template for the post type. The hierarchy uses the file name to determine which one, not the comment in the file. The comment in the file is for Page/Post templates for the dropdown list.
I would like to be able to use my Page Builder plugin for the Therapist content data.
The template file should not provide the content (besides handling the custom fields specific to the post type), but should always display whatever was entered in the editor (whichever one is used). So your statement doesn’t make any sense to me.
A plugin can also use the template_include filter to specify a different template than the one found from the hierarchy. (Themes should not modify this.)
https://developer.wordpress.org/reference/hooks/template_include/
Excellent, it’s clear. Thank you Joy.
The difference between Page and Post for the Page Builder is that it doesn’t always behave well with Post type as opposed to Page type.