Update get_theme_slug
to allow theme names with hyphens/spaces
#228
Labels
enhancement
New feature or request
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
get_theme_slug
to allow theme names with hyphens/spaces
#228
This is a very difficult problem to solve. I would love to but I'm not sure how. You're correct; the spaces in slugs are removed since we are unable to 100% determine when a slug should be The zip file SHOULD match the slug now so at least that aspect of this task is complete (no spaces in that either). However it would be much MORE correct if the correct slug were used instead. |
get_theme_slug
to allow theme names with hyphensget_theme_slug
to allow theme names with hyphens/spaces
👏 Thank you!! |
Any theme name that includes a space needs to either have the space removed or replaced with a hyphen for use in the directory name and the text domain.
Currently, the
get_theme_slug
function is removing hyphens from a new theme name based on the following logic:When the source theme has a single-word slug but the new theme has a multi-word slug (e.g. cloning twentytwentythree and then naming the new theme tt3-clone would change the new theme name to 'tt3clone').
This can be confusing, as the .zip file has a different name to the chosen theme name, and it results in some discrepancies throughout the theme code where the slug is referenced, such as in pattern blocks and the Text Domain.
I believe this was to prevent hyphens from being used in theme support functions (e.g.
tt3-clone_support()
), but perhaps this logic could be more specific to the function name creation, rather than the theme slug itself. Could we replace the hyphens with underscores just for function names?This issue came up while testing #213.
The text was updated successfully, but these errors were encountered: