Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow spaces in theme slugs #622

Merged
merged 1 commit into from
May 10, 2024
Merged

Allow spaces in theme slugs #622

merged 1 commit into from
May 10, 2024

Conversation

pbking
Copy link
Contributor

@pbking pbking commented May 9, 2024

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:

  • Using the CBT interface in the Editor
  • Create a Blank theme with a name that contains spaces, dashes and/or underscores
  • Clone a theme with a name spaces, dashes and/or underscores

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).

Copy link
Contributor

@madhusudhand madhusudhand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works great! 🚢

@pbking pbking merged commit f3dc5c9 into trunk May 10, 2024
2 checks passed
@pbking pbking deleted the try/hyphenated-slugs branch May 10, 2024 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Update get_theme_slug to allow theme names with hyphens/spaces
2 participants