Skip to content

theme.json v2: track changes #34349

Closed
Closed

Description

@oandregal

Part of #20331

This issue is to track the changes we need to introduce in WordPress 5.9, which we should match to a new schema for theme.json.

Activity

  1. oandregal commented on Aug 27, 2021

    @oandregal
    MemberAuthor

    In origin, we used the custom* prefix for things that had both a preset and custom colors added by the user. For example, color.customGradient means the users can't use the custom colors in gradients, they are limited to preset gradients. However, color.link means the users can't set link color.

    We should remove the custom* prefix those properties that don't need it: spacing.margin, spacing.padding, typography.lineHeight.

  2. oandregal commented on Aug 27, 2021

    @oandregal
    MemberAuthor

    cc @mtias @youknowriad @mcsf @jorgefilipecosta @gziolo @aaronrobertshaw @ramonjd

    We can implement the migration from v1 to v2 for the properties above, as we did in the plugin when we introduced v1 (see), so in theme.json you'd use the name without the custom prefix.

    I wonder how this affects the "internal" names: ideally, the names of the properties in the __experimentalFeatures passed to the client can be also updated as well as the store. I understand this may require 3rd parties that hook into the block settings filter to update their filters, if they modify these values. Is this a reasonable request? I think it is, because a theme.json v2 could introduce shape changes anyway.

  3. mtias commented on Aug 27, 2021

    @mtias
    Member

    We should perhaps leave the renaming for when we stabilize and remove the __experimental.

  4. added
    [Feature] Themes
    [Type] Task
    Global Styles
    on Aug 31, 2021
  5. uniquesolution commented on Oct 8, 2021

    @uniquesolution

    How about having multiple conditional theme.json files, so that one site can have multiple theme global styls for different pages conditionally? For example as we select page template is in page editor, how about having an option to also choose a different theme.json file ?

  6. mtias commented on Oct 8, 2021

    @mtias
    Member

    Multiple json files is indeed on the roadmap and conceptualized in the initial scope. The idea is it can be composed in a similar way to the theme hierarchy — so it can match a set of templates, or an individual page, etc. The idea is that template parts could also be theme.json providers, meaning you could overwrite or specify settings for ay template part in complex scenarios. Think a case where a sidebar might require a different set of color presets than the rest of the site.

    Swapping theme.json files altogether will also be a good affordance for themes offering different schemes, etc. A dark theme could also be conceptualized under that model easily.

  7. uniquesolution commented on Oct 9, 2021

    @uniquesolution

    Is this coming in Wordpress 5.9 ? Where we can see progress in this topic ? I would like see this particular topic progress and want to participate in suggestion if I find useful.

  8. oandregal commented on Nov 2, 2021

    @oandregal
    MemberAuthor

    PRs to remove the custom prefix from existing v1 settings at #36154 and #36155

  9. oandregal commented on Nov 5, 2021

    @oandregal
    MemberAuthor

    All tasks here have landed so I'm closing this. For reference, I'm porting the changes to WordPress core at WordPress/wordpress-develop#1808

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global Styles[Feature] Themes[Type] Task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions