Site logo

[Support request] Add margin to blocks in Gutenberg

Home Forums Support [Support request] Add margin to blocks in Gutenberg

Home Forums Support Add margin to blocks in Gutenberg

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2555237
    webintas

    Hi there,

    I am building a new site with GP Premium and just Gutenberg. I have been used to start WordPress sites by installing Classic Editor and Elementor but now i wanted to give Gutenberg a shot to make the site as clean and WP’ish as possible.

    However, sometimes I really need to add some margin or padding to an element. Do you know if there are some kind of setting that can activate that? I have been looking this document: https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json/ but to be honest I do not understand that much of it. I think margin and padding should be a default option in Gutenberg. Do you know if it’s possible to add – I prefer non-plugin solutions?

    #2555270
    David
    Staff
    Customer Support

    Hi there,

    for core blocks you can add this PHP Snippet:

    add_theme_support( 'custom-spacing' );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    If you want a more advanced editor then use the GenerateBlocks plugin

    #2555293
    webintas

    Hi David,

    Thanks for your reply!
    I have tried the custom-spacing-thing but that only gives me padding. Do you experience the same?

    Best Regards,
    Peter

    #2555671
    Leo
    Staff
    Customer Support

    I have tried the custom-spacing-thing but that only gives me padding.

    That is correct behaviour as suggested here: https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json/#backward-compatibility-with-add_theme_support

    From that table, I don’t see a command for adding margins though.

    If you are after complete control over the blocks, then I would highly recommend using GenerateBlocks as David mentioned. The Spacing options should provide exactly what you are looking for:
    https://docs.generateblocks.com/article/spacing-options-overview/

    I can almost promise that your Gutenberg experience will be a lot better if you use GenerateBlocks 🙂

    #2557005
    webintas

    Hi Leo,

    Thanks for your reply and clarification! I am considering GenerateBlocks. However, it will not add margin options for standard blocks as image, right?

    Also, from my client’s perspective it is confusing that there is no Danish translation and also it makes “duplicate” blocks, where there are two options for e.g. Headline – the default and the GenerateBlocks-one – that’s confusing for everyday WordPress editors I guess.

    Best Regards,
    Peter

    #2557021
    Fernando
    Customer Support

    Hi Webintas,

    Yes, that’s correct. It won’t add those options for WordPress Blocks. The options would just exist for GenerateBlocks blocks.

    What exactly are you trying to translate to Danish?

    I’m not sure what you mean by “duplicate” blocks. Can you share a screenshot of this? Uploading Screenshots: https://docs.generatepress.com/article/using-the-premium-support-forum/#uploading-screenshots

    #2557616
    webintas

    Hi Fernando,

    I think this screenshot will explain: https://www.screencast.com/t/ziD7IPoyR

    I am not exactly trying to translate something, it is more the fact that it is not translated yet.

    #2558153
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Translations need to be made here: https://translate.wordpress.org/projects/wp-plugins/generateblocks/

    Once a translation hits 90% (I believe) it can be automatically shipped by WordPress.

    Let us know if you have any other questions 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.