-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Additional CSS option is missing when a block theme does not include a theme.json #52750
Comments
Hi, |
I can reproduce this issue, but I'm not certain it's a bug 😅 The way that global styles is implemented means that if the theme doesn't provide a theme.json file, the wp_global_styles custom post type never gets created (see relevant code here). Without the custom post type, nothing the global styles panel works at all, including additional CSS. I think ideally we should hide the whole panel, because trying to edit styles with no result is a very broken experience. This raises a few questions though:
|
Requiring theme.json now would be a breaking change. In its most simple version, a block theme is only a style.css and a index.html file. It would only use a theme.json if it needed to overwrite the WordPress defaults. |
That makes sense! I think the best thing to do for now is to hide the global styles panel. If a theme were using a stylesheet for its CSS instead of theme.json, it wouldn't be possible for users to edit the theme styles in global styles anyway. |
Looks like there's an issue for this from 2020: |
I think the option needs to be available even if the theme does not add any changes to the default styling or settings. Thinking of how classic themes and the Customizer work, I can still use the Customizer's CSS field even if the theme does not add any Customizer controls. |
That's a good point, but the implementation of Additional CSS in global styles won't make this easy. As I mentioned above, it's saved in the I think if we want to make Additional CSS available for block themes without theme.json, we'll need a whole new implementation for it. How impactful might that work be? Is this a useful enough feature for enough people that it would be worth the developer time investment? |
Description
Block themes are not required to include a theme.json file in order to be activated on a WordPress installation.
When such a theme is activated, the global Additional CSS and the blocks additional CSS fields in the Site Editor are missing.
Step-by-step reproduction instructions
Activate a block theme without theme.json.
Go to Appearance > Editor > edit any template or select "Styles".
Look for the Additional CSS fields in the Styles sidebar.
Screenshots, screen recording, code snippet
No response
Environment info
Only tested on 6.3 Rc 1.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: