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

Fix theme font sizes not working when the slug matches Gutenberg defaults #58394

Closed

Conversation

SantosGuillamot
Copy link
Contributor

What?

This is an attempt to fix #57889.

I must say that I am not familiar with this part of the codebase so maybe this is not the right approach.

Why?

Right now, if a theme defines a fontSize with the same slug as Gutenberg defaults (small, medium, large, etc.), the value is overridden by the Gutenberg default value.

How?

I just changed the prevent_override option to false, which seems to allow themes to override Gutenberg defaults.

Testing Instructions

  • In a site, install a theme with fontSizes defined in the theme.json using the slug and name "small" and a size you can identify:
        {
          "fluid": false,
          "name": "Small",
          "size": "20px",
          "slug": "small"
        },

You can do the same with medium and large.

  • In a page or in the Site editor, go to the styles of a paragraph and check that the value defined by the theme is applied. Before this pull request it applies Gutenberg value.
  • Go to the frontend and check that works as well.
  • Remove the "small" font size you added.
  • Check now that the "small" font size is still there but with the Gutenberg default value.

@SantosGuillamot SantosGuillamot added [Type] Bug An existing feature does not function as intended Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) labels Jan 29, 2024
Copy link

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/class-wp-theme-json-gutenberg.php

@SantosGuillamot
Copy link
Contributor Author

Closing this because it will be handled in this other pull request.

@SantosGuillamot SantosGuillamot deleted the fix/theme-defined-font-sizes-not-working branch January 30, 2024 16:31
@cbravobernal cbravobernal removed the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typography: Theme defined font sizes are no longer working
2 participants