Function to allow single post template based on custom taxonomy?

I’m trying to use Justin Tadlocks function for category specific custom post templates, but have become stuck when trying with a custom taxonomy, as his examples only have normal categories.

Can this be edited to work with custom tax’s?

Thanks for any help 🙂

Solutions Collecting From Web of "Function to allow single post template based on custom taxonomy?"

I think what you’re looking for is the WordPress Template Hierarchy. Basically you can just name the template single-{custom-post-slug}.php and put it in the right directory.

Update

Now that I understand what you’re actually asking: I bet you could hook {$type}_template, which is called by get_query_template(). It’s expecting a path to the template which has been loaded. You can filter based on get_queried_object() so that the correct template is used in the correct place. It’s probably gonna take a bit of tinkering and a lot of print_r()ing on your part, but I think it’s doable.