Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Forum: Plugins
    In reply to: [Gutenberg] Container Block

    @hozefasmile oh yes, i agree, very hacky.

    personally i just ended up creating my own block using a plugin, duplicated from the group block that exists with the gutenberg plugin. it’s literally a matter of removing that one div.

    it’s not like it’s a complicated matter … although i do admit i’m not all that knowledgeable and all this is very new to me – so perhaps that container serves some kind of purpose that i just can’t see right now.

    <div className={ classes } style={ styles }>
    <div className="wp-block-group__inner-container">
    <InnerBlocks
    renderAppender={ ! hasInnerBlocks && InnerBlocks.ButtonBlockAppender }
    />
    </div>
    </div>

    which is still a messy, hacky approach since with future updates the entire content might be lost – if for whatever reason the plugin doesn’t work/is removed – all the content is lost, you can’t even keep the html. as far as i can tell this is a known issue with all blocks containing other blocks ( InnerBlocks component ) – other people have talked about this elsewhere.

    by the way – that is also the case with the official gutenberg plugin – if you remove the plugin for whatever reason – you can’t salvage the content, not even by converting it to html.

    the only way to keep the content that i know of is to use a classic editor plugin – and open the page directly with the classic editor. that keeps the content/html/layout.

    it’s all just very, very messy no matter how you look at it.

    the only true solution you have right now is to try and trick the designer into designing something that doesn’t require these kinds of features. :))

    Forum: Plugins
    In reply to: [Gutenberg] Container Block

    @hozefasmile As far as I can tell there’s no way to get rid of that inner-container.

    One solution is to use a script for the frontend and add the row class to that inner container. But it also limits your use of multiple rows within the same container.

    Instead of being able to have container > row + row + row … you’d need to use container > row / container > row / container > row.

    Add this to your scripts.js.

    $(".bootstrap-fix .container > .wp-block-group__inner-container").addClass("row").removeClass("wp-block-group__inner-container");

    However it’s a bit hacky and only works with certain scenarios and with new updates if they change the layout/class name you’d need to fix it.

    So when adding content you’d no longer be adding 3 group blocks, you’d add only one group block ( with a custom class of container and the script would add the row class to the inner container created by WP ) and then only the group blocks for columns.

    I’d also recommend removing the inner class from the column group blocks.

    $(".bootstrap-fix .row > div > .wp-block-group__inner-container").removeClass("wp-block-group__inner-container");

    I use a .bootstrap-fix class for the content section of my custom pages just in case – to make sure there are no conflicts with my hard-coded layouts.

    It also limits the use of align-items-center/justify-content … as you can no longer add classes to the row container.

    I ended up adding yet another script where I applied those 2 classes ( align/justify ) to the container group and they got passed down to the row.

    It’s all very messy but I haven’t been able to find another option.

    And yes – no javascript on the browser, everything breaks down.

    • This reply was modified 4 years, 9 months ago by Emil G.
    Thread Starter Emil G

    (@dagu)

    Technically, I could. Practically, I’m a bit uneasy about how much longer that block will be around.

    What if next year it gets phased out ? What happens then ? Some of the websites I build are not exactly managed. In an ideal world someone would be managing each and every website. In the real world, there are some types of websites that simply don’t get that much attention. So they need to be stable for 1-2, even 3 years from now.

    But yeah, right now that’s what I’ve been doing since I have no other alternative.

    • This reply was modified 4 years, 10 months ago by Emil G.
    Thread Starter Emil G

    (@dagu)

    Well, that’s good to know. Already suspected that much, was just hoping it would make it to the next update. But as far as I can tell, no chance of that.

    For the past half a year or more now WP has been very frustrating to work with for this one reason.

    Thread Starter Emil G

    (@dagu)

    I was unclear … meant in WordPress, not in the Gutenberg plugin.

    Look, I get that this would probably be useless to regular users, just people writing their blogs … but it would be a godsend for anyone developing themes with inconsistent layouts that can’t be hardcoded in.

Viewing 5 replies - 1 through 5 (of 5 total)