1
votes

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.

3

3 Answers

0
votes

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

0
votes

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;

}