Support

Account

Home Forums Gutenberg Core spacing supports for ACF blocks

Helping

Core spacing supports for ACF blocks

  • Hello.
    Building some custom ACF blocks, and can’t get the spacing attribute to show in the php template ie frontend.

    My block.json looks like:

    "supports": {
       "align": true,
       "spacing": {
          "margin": true
       }
    }

    I can get the spacing to work in the editor, but nothing is being set in the frontend. I tried in my php template:

    $classes .= ' ' . $block['style']['margin'];
    $classes .= ' ' . $block['spacing']['margin'];
    $classes .= ' ' . $block['spacing'];
    $classes .= ' ' . $block['margin'];

    but none of them spit out a anything in the frontend.

    Any help would be appreciated

  • Try this:

    $classes .= ' ' . $block['style']['spacing']['margin']['top'];

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.