Make Custom Taxonomy Category Use Parent Template

Hook into template_include filter

add_filter('template_include', 'research_term_template');

function research_term_template( $template ) {
  if ( is_tax('classifications') ) {
    $parent = get_term_by('slug', 'oldresearch', 'classifications');
    // to improve performance you can hardcoding 'oldresearch' term id
    // $parent = 12;
    if ( term_is_ancestor_of( $parent, get_queried_object(), 'classifications' ) )
       return get_template_directory() . '/taxonomy-Classifications-oldresearch.php';
  }
  return $template;
}

Leave a Comment