WordPress / create-block-theme

A WordPress plugin to create block themes
https://wordpress.org/plugins/create-block-theme/
GNU General Public License v2.0
310 stars 44 forks source link

Allow spaces in theme slugs #622

Closed pbking closed 1 month ago

pbking commented 1 month ago

This change allows spaces in theme slugs.

(I thought this would be a much harder problem, but it was actually pretty easy.)

I realized that any time a slug with 's needed to be replaced it was ALSO followed by a ( i.e. slug_name_function and never just slug_name). So replacing old_slug_ with new_slug_ was the answer.

The order of replacement (replacing slugs with 's first) had to be changed to make sure that when cloning a theme without 's in the slug that the functions were correctly changed.

Fixes #228

To Test:

Observe that the new theme has the correct textdomain and it is used correctly throughout the theme (especially in PHP files with functions that use the theme slug such as functions.php).