diff --git a/admin/create-theme/cbt-zip-archive.php b/admin/create-theme/cbt-zip-archive.php index 4862fc9d..3799192c 100644 --- a/admin/create-theme/cbt-zip-archive.php +++ b/admin/create-theme/cbt-zip-archive.php @@ -8,21 +8,24 @@ class CbtZipArchive extends ZipArchive { private string $theme_slug; function __construct( $theme_slug ) { - $this->theme_slug = $theme_slug; + // If the original theme is in a subfolder the theme slug will be the last part of the path + $complete_slug = explode( DIRECTORY_SEPARATOR, $theme_slug ); + $folder = end( $complete_slug ); + $this->theme_folder = $folder; } function addFromStringToTheme( $name, $content ) { - $name = $this->theme_slug . '/' . $name; + $name = $this->theme_folder . '/' . $name; return parent::addFromString( $name, $content ); } function addFileToTheme( $filepath, $entryname ) { - $entryname = $this->theme_slug . '/' . $entryname; + $entryname = $this->theme_folder . '/' . $entryname; return parent::addFile( $filepath, $entryname ); } function addThemeDir( $dirname ) { - $dirname = $this->theme_slug . '/' . $dirname; + $dirname = $this->theme_folder . '/' . $dirname; return parent::addEmptyDir( $dirname ); }