How would this be adapted to apply to specific custom taxonomies?
add_filter( 'body_class', 'custom_cat_archiev_class' );
function custom_cat_archiev_class( $classes ) {
if ( is_category() ) {
$cat = get_queried_object();
$ancestors = get_ancestors( $cat->term_id, 'category', 'taxonomy' );
$classes[] = 'catlevel-' . ( count( $ancestors ) + 1 );
}
return $classes;
}