Support » Plugin: Grids: Layout builder for WordPress » CSS classes for block styles (in editor)

  • Resolved strarsis

    (@strarsis)


    Block styles can be registered for areas (grids/area) which is great.
    But when a block style is selected for the area block, no CSS class is applied (is-style-<block style id> in the editor (it is on frontend), so it can’t be styled in editor.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Andrea Gandino

    (@andg)

    Hello there!

    First of all, thanks for trying out Grids!

    Secondly, the thing you’re reporting is happening because the Area block is not declaring any block style.

    We intend styles as variants of the same block: Area blocks, while having several different parameters that define them, are not “different” in terms of variants.

    On the other hand, if you have a more specific use case for block styles being defined (and classes added to the block element), please do tell us, so that we can think of a solution for the issue.

    Thread Starter strarsis

    (@strarsis)

    @andg: In this case I want the theme to apply a special background to it using CSS.

    Alternatively, a group block could be nested inside the area, but this would add an extra block. On the other hand, the group block could be used also outside of the area.

    But then again, maybe Gutenberg should offer a background image option additionally to background colour for all blocks as a core feature…

    Plugin Contributor Andrea Gandino

    (@andg)

    @strarsis the CSS selector for Areas is:

    .wp-block[data-type="grids/area"]

    and it’ll allow you to target all areas created by Grids.

    Additionally, but is something that goes beyond the scope of the theme, Areas also support backgrounds natively: to set a background for an Area, check out the Background panel on the right sidebar, when you’re currently focusing on the Area and not the content blocks in it (this may be a bit tricky in Gutenberg, but it’s not that hard once you get the hang of it).

    See: https://imgur.com/iCRwKQQ

    Thread Starter strarsis

    (@strarsis)

    @andg: Thanks. So now the theme needs a way to offer/force specific background images, but this seems to be a Gutenberg core issue then.

    Plugin Contributor Andrea Gandino

    (@andg)

    Yes, it is. I’m marking this ticket as solved now.

    Thread Starter strarsis

    (@strarsis)

    OT, but there is a GitHub issue in Gutenberg repository for a grid block:
    https://github.com/WordPress/gutenberg/issues/16271

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘CSS classes for block styles (in editor)’ is closed to new replies.