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

Tutorial on using block style variations in WordPress 6.6 #270

Closed
bph opened this issue Jun 7, 2024 Discussed in #268 · 9 comments
Closed

Tutorial on using block style variations in WordPress 6.6 #270

bph opened this issue Jun 7, 2024 Discussed in #268 · 9 comments
Assignees

Comments

@bph
Copy link
Collaborator

bph commented Jun 7, 2024

Discussed in #268

Originally posted by justintadlock June 4, 2024
Block style variations will see some major improvements in WP 6.6:

  • Themers can define styles for custom variations via theme.json, which was previously limited to Core-only variations (styles.blocks.blockName.variations).
  • They can define variations for multiple blocks via styles.blocks.variations.
  • 👆 These can also be defined as individual JSON files under the /styles folder with the blockTypes property.
  • Style variations can contain styles for nested elements and blocks (i.e., "section" styles).

See:

These are major improvements to the block style variations system that could potentially save 100s of lines of custom CSS and consolidate most theme styling to the standard theme.json.

It's also a good opportunity to call for testing of potential breaking issues with reduced style specificity:

A tutorial for the Dev Blog would be welcome that explores what each of these changes mean for styling themes and how that compares to what was previously possible. It should also explore any potential pitfalls or areas where you still need to rely on custom code. But the big thing is to share the major "wins" that these update bring to theme design.

A side note to consider: this could be the precursor to opening custom style variations via the Styles panel in the editor UI.

@justintadlock
Copy link

This one is ready to review now.

@ndiego
Copy link
Member

ndiego commented Jun 20, 2024

Great article @justintadlock. Added some notes/suggestions.

@colorful-tones
Copy link
Member

@justintadlock I read through about 3/4. I mainly wanted to understand this feature because I feel out of the loop. I left some relatively high-level reflections as comments in the document. Please feel free to disregard them and consider them just me thinking out loud. Thanks for writing this up and taking the time to share it all.

@justintadlock
Copy link

Finished with the first review.

@colorful-tones - Want to read the last 1/4 and wrap up the 2nd review?

@colorful-tones
Copy link
Member

@justintadlock I finished reading 😄 .

I like the update with Section 1 + Section 2; it solves the contextual use case well. 👍
I made one small suggestion. Looks great to me!

I particularly like the authenticity of the following:

It’s a simple thing, but it made me happy.

🫶 🤘

@justintadlock
Copy link

Thanks, @ndiego and @colorful-tones! I've went through everything and did another editing pass myself. Planning to publish tomorrow.

Note to self: Check if the linked Dev Note in the post is published. If not, reword the sentence and add the Dev Note link later.

@justintadlock
Copy link

Social Copy:

Learn how to use Block Style Variations for section styling and more with WordPress 6.6:

https://developer.wordpress.org/news/2024/06/21/styling-sections-nested-elements-and-more-with-block-style-variations-in-wordpress-6-6/

@bph
Copy link
Collaborator Author

bph commented Jul 15, 2024

scheduled for July 24

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