From 9b0a9ab91dd2be6303c8461a85b99ce1e37873d8 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Thu, 28 Jul 2022 17:51:54 +0200 Subject: [PATCH] duplicate variations with the same name instead of replacing them --- admin/class-create-block-theme-admin.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/admin/class-create-block-theme-admin.php b/admin/class-create-block-theme-admin.php index 57eae62d..b7b5f354 100644 --- a/admin/class-create-block-theme-admin.php +++ b/admin/class-create-block-theme-admin.php @@ -353,6 +353,14 @@ function add_theme_json_variation_to_local ( $export_type, $theme ) { $variation_slug = $variation_slug . '_' . $file_counter; } + if ( file_exists( $variation_path . $variation_slug . '.json' ) ) { + $file_counter++; + while ( file_exists( $variation_path . $variation_slug . '_' . $file_counter . '.json' ) ) { + $file_counter++; + } + $variation_slug = $variation_slug . '_' . $file_counter; + } + $_GET['theme']['variation_slug'] = $variation_slug; file_put_contents(