I have a number of custom post types that I would like to display with the same template which I have created initially as single-photography.php
in my theme.
Is there any way to assign this template to multiple custom post types?
I understand I can probably do this within the single.php
file with a conditional include based on get_post_type()
, but I’m wondering if there is a better way?
You can filter
template_include
and pass your custom template as return value depending on your own conditions.Sample code, not tested: