0

I wish to add/change class for this div:

<div class="wp-block-columns has-2-columns">

There is no possibly to use "wp.blocks.registerBlockStyle" because it doesn't work for core/columns blocks ("The editor has encountered an unexpected error."). So I did it by JS (jQuery in fact), using

.addClass('my-custom-class'+styleChoosenByUser)

It works - class is added to div in back-office. But of course after refresh F5 class disappear.

So - is it possible to add class to block dynamically? And is it possible to add data to some div?

If not, is it possible to add class dynamically to Advanced "Additional CSS Class" input?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.