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

Schema changes for WordPress 4.7 #1164

Closed
pavelevap opened this Issue Dec 9, 2016 · 6 comments

Comments

Projects
2 participants
@pavelevap
Contributor

pavelevap commented Dec 9, 2016

I will add overview of schema changes for new features in WordPress 4.7 and try to make a PR.

@borekb

This comment has been minimized.

Member

borekb commented Dec 11, 2016

Excellent, thank you!

@pavelevap

This comment has been minimized.

Contributor

pavelevap commented Dec 12, 2016

I found other complications with latest commit: ccd3935

  1. 4 panels is only default value for Twenty Seventeen, child themes and plugins can easily change that with twentyseventeen_front_page_sections filter. We would need something like that (not sure if possible with VP currently or I do not know the right syntax): theme_mods_*["panel_{integer}"]: post

  2. Because of asterix in theme_mods_* it will work automatically for child themes (which is good), but there is a possible conflict. It will "work" for all themes, even if they use the same option name for example for a string or HTML content (which is not good). So, maybe we should extract this rule and add it to special schema.yml for Twenty Seventeen (and child themes)?

@borekb

This comment has been minimized.

Member

borekb commented Jun 7, 2017

  1. Regex \d could be used here.
  2. Do you have an example of how this would look? Thanks.
@pavelevap

This comment has been minimized.

Contributor

pavelevap commented Jun 7, 2017

ad 2) Examples:

  • Default Twenty Seventeen: We can use hardcoded option theme_mods_twentyseventeen, but child themes will be not supported.
  • Child theme: We can use asterix theme_mods_* for handling different options, for example theme_mods_twentyseventeen-child, etc. It is common to use parent theme name in child theme, for example twentyseventeen-child, but it is not required and it can be also my-custom-2017. But we can use also theme_mods_twentyseventeen* to support only some child themes and avoid conflicts (see next point).
  • But there are possible conflicts when using for example premium theme (theme_mods_premium-theme) with custom options with the same name panel_1 and panel_2 (common names). And when they do not contain entities, but only text with numbers, for example address "Street 12", it will be converted to entities in this case (number 12 to VPID).

So, ultimate solution is using theme_mods_*, but only for Twenty Seventeen (and child themes). But in this case this rule should be added to special schema.yml file only for this theme (and applied when theme is active).

@borekb

This comment has been minimized.

Member

borekb commented Jun 7, 2017

I see, so theme_mods_* is perfectly fine in something like wp-content/themes/twentyseventeen/.versionpress/schema.yml (or whatever ends up being the path for theme schemas) but might cause conflicts in the core schema.yml file, correct?

Would something like theme_mods_twenty* be a reasonable workaround until theme schemas are supported properly?

@pavelevap

This comment has been minimized.

Contributor

pavelevap commented Jun 7, 2017

Yes, exactly!

Yes, this workaround should work for most of child themes and it is probably the best solution for now. I will add related commit and we should finally take care of this problem in #1176.

pavelevap added a commit that referenced this issue Jun 9, 2017

[#1164] Improvements for Twenty Seventeen
- Limit option only for Twenty Seventeen and related child themes with
standard names.
- Allow custom number of panels.

@borekb borekb closed this in #1239 Jun 12, 2017

@borekb borekb moved this from New to Done in 4.0-beta Jun 12, 2017

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