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

A method for adding block variants #9104

Closed
BinaryMoon opened this issue Aug 17, 2018 · 5 comments
Closed

A method for adding block variants #9104

BinaryMoon opened this issue Aug 17, 2018 · 5 comments
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@BinaryMoon
Copy link

BinaryMoon commented Aug 17, 2018

I would like to add block variants to my theme, essentially adding classes to the block container. I already add css classes to the theme and they can be styled in the editor by adding the custom class in the advanced block settings, but if there was an easy way to add additional variants then it would improve discoverability for users.

Ideally this would be a simple php request added via add_theme_support. Something along the lines of:

add_theme_support(
   'block-variants',
   array(
      'block-name-1' => array(
         'variant-class-1',
         'variant-class-2',
         'variant-class-3',
      ),
      'block-name-2' => array(
         'variant-class-1',
         'variant-class-2',
         'variant-class-3',
      ),
   )
);

I guess a javascript option would be possible also, but using add_theme_support seems like a clean and elegant 'WordPressy' way to do it. But any method would be great.

@youknowriad
Copy link
Contributor

It's already possible in JavaScript see #7997

Documentation is lacking though.

@BinaryMoon
Copy link
Author

BinaryMoon commented Aug 17, 2018

Ah ha - excellent. And I've now found a ticket for adding docs: #8145

Is there a way to escalate that ticket? The only way to get people to use these things (and test them) is if they know how they work.

@youknowriad
Copy link
Contributor

Maybe you can help adding this to the docs :) The Block API page on the handbook seems like a good page for it :)

@youknowriad
Copy link
Contributor

I'm closing this issue for now. but yeah I'll try to see if I can add docs if no one beats me to it. :)

@BinaryMoon
Copy link
Author

I would happily add to the docs but since I don't understand how to use the command I can't document it :)

@designsimply designsimply added [Feature] Extensibility The ability to extend blocks or the editing experience [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

No branches or pull requests

3 participants