Skip to content

wp_theme_has_theme_json: add public method to know whether the theme supports theme.json - #3556

Closed
oandregal wants to merge 15 commits into
WordPress:trunkfrom
oandregal:add/wp-theme-has-theme-json
Closed

wp_theme_has_theme_json: add public method to know whether the theme supports theme.json#3556
oandregal wants to merge 15 commits into
WordPress:trunkfrom
oandregal:add/wp-theme-has-theme-json

Conversation

@oandregal

@oandregal oandregal commented Nov 3, 2022

Copy link
Copy Markdown
Member

Trac ticket https://core.trac.wordpress.org/ticket/56975

Related Gutenberg PRs:

Lnking to Gutenberg's 6.2 backport tracking ticket.

What

Adds a new public method wp_theme_has_theme_json that checks whether a theme has a theme.json file.

Why

Part of WordPress/gutenberg#45171

This offers consumers a public API so they don't have to rely on private code. Additionally, it uses the object cache under the theme_json group to maintain this data, consolidating with the changes done for settings (core PR) and settings (core PR soon, see Gutenberg PR instead).

How

Creates the new public method, substitutes usage, and deprecates the old one.

Test

  • Verify that automated tests pass.
  • Using TwentyTwentyThree (a theme with a theme.json) and then a TwentyTwentyOne (a theme without theme.json) do the following:
    • Load the front-end. Verify that styles load as expected.
    • Load the post editor. Verify that the presets (e.g.: color) are set correctly in the block inspector.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants