I'm working on a major WordPress site and ran into a problem where I need to use multiple custom post types, but I only want to use one template for all of them.
I found a code by Brad Dalton of WPSites that works with a single CPT name. Looking for a solution that allows multiple CPTs. Source: http://wpsites.net/web-design/using-different-custom-single-post-templates/
What I want is the ability to use cpt-1, cpt-2, cpt-3. I'm not a PHP coder, not quite sure how to make this an array that will work in my functions.php
BTW, I wish there was a is_post_type_single
like there is a is_post_type_archive
. Would be much easier to default to all CPT Single templates.
Editing Reasons: Removed Brad's code to respect his copyright. Added link to source.