Skip to content

Commit

Permalink
duplicate variations with the same name instead of replacing them
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera authored and scruffian committed Jul 29, 2022
1 parent 8535212 commit 9b0a9ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions admin/class-create-block-theme-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9b0a9ab

Please sign in to comment.