parent ? get_category($current_category->parent) : $current_category; // Если текущая или родительская рубрика в списке if (in_array($parent_category->slug, $target_parent_slugs)) { $new_template = locate_template("category-{$parent_category->slug}.php"); if ($new_template) return $new_template; } return $template; });