Reputation: 573
I've created a custom post type named "accommodation" and taxonomy for it named "categories" using the file "taxonomy-accommodation-categories.php" - this is working fine in my WordPress theme.
But I want to add this in a separate plugin instead, does anyone know how I can do this?
Appreciate any help, thanks.
Upvotes: 1
Views: 924
Reputation: 1766
This is must work :
add_filter('template_include', 'taxonomy_template');
function taxonomy_template( $template ){
if( is_tax('accommodation-categories')){
$template = BASE_DIR .'/templates/taxonomy-accommodation-categories.php';
}
return $template;
}
Upvotes: 0
Reputation: 3
The wordpress codex has instructions on how to do this, https://codex.wordpress.org/Plugin_API/Filter_Reference/single_template
The github link posted before also has the same thing but more explained
Upvotes: 0
Reputation: 313
I think this is what you are looking for. https://gist.github.com/vishalbasnet23/4cf739624ba3b75e75d8
Upvotes: 1