// Arthur - custom template selon custom category add_filter('single_template','check_for_category_single_template'); function check_for_category_single_template($t) { $cats = get_the_terms(get_the_ID(),'project-type'); foreach((array)$cats as $cat) { if (file_exists(get_stylesheet_directory().'/single-'.$cat->slug.'.php')) return get_stylesheet_directory().'/single-'.$cat->slug.'.php'; if ($cat->parent) { $cat = get_the_category_by_ID($cat->parent); if (file_exists(get_stylesheet_directory().'/single-'.$cat->slug.'.php')) return get_stylesheet_directory().'/single-'.$cat->slug.'.php'; } } return $t; }