liip / bootstrap-blocks-wordpress-plugin

Bootstrap Gutenberg Blocks for WordPress
https://wordpress.org/plugins/wp-bootstrap-blocks/
279 stars 60 forks source link

Struggling to get 1 x col 12 in a row #68

Closed bsweb closed 3 years ago

bsweb commented 3 years ago

Hi,

The default row contains 2 x col-12 col-md-6 columns but I just want 1 x col-12 column but I can't get rid of the other column. Changing to 0 doesn't work and no option to remove.

Thanks.

tschortsch commented 3 years ago

Hi @bsweb. You can choose the Custom layout of the Row block to add and remove Columns manually. Otherwise you can change the default behavior of the row block by defining the following filters:

  1. Add a new block template with the wpBootstrapBlocks.row.templates JavaScript filter (see: https://github.com/liip/bootstrap-blocks-wordpress-plugin#wpbootstrapblocksrowtemplates)
  2. Set this new template to be the default template when a new row block is inserted with the wp_bootstrap_blocks_row_default_attributes PHP filter (see: https://github.com/liip/bootstrap-blocks-wordpress-plugin#wp_bootstrap_blocks_row_default_attributes)
bsweb commented 3 years ago

Managed to get around to looking at this and I can't get it to work, I just get image

I am trying to achieve this (tried to paste html but doesn't preview). The parent row works but the issue is when I try and do the children row in the first column that is highlighted image

This is the code generated and not liked by WordPress. This is in the first column of the parent row.

<!-- wp:wp-bootstrap-blocks/row {"template":"custom"} --> <!-- wp:wp-bootstrap-blocks/column --> <!-- wp:heading {"level":1,"className":"mb-0 mb-1"} --> <h1 class="mb-0 mb-1">Private Ski Coaching</h1> <!-- /wp:heading --> <!-- wp:heading {"textAlign":"left","className":"subtitle mb-0"} --> <h2 class="has-text-align-left subtitle mb-0">On the Mountain - levels 1 to 6</h2> <!-- /wp:heading --> <!-- wp:heading {"textAlign":"left","className":"subtitle"} --> <h2 class="has-text-align-left subtitle">In the UK - levels 2 to 6</h2> <!-- /wp:heading --> <!-- /wp:wp-bootstrap-blocks/column --> <!-- /wp:wp-bootstrap-blocks/row -->

image

The recovery options don't work and I have to start again.

tschortsch commented 3 years ago

Hmm I just recreated your described layout in a dummy WordPress 5.6 instance.

gh-issue-68-editor

Here's the generated code:

<!-- wp:wp-bootstrap-blocks/row -->
<!-- wp:wp-bootstrap-blocks/column {"sizeXs":8} -->
<!-- wp:wp-bootstrap-blocks/row {"template":"custom"} -->
<!-- wp:wp-bootstrap-blocks/column -->
<!-- wp:paragraph -->
<p>Row 1 Col 1 &gt; Row 1-1 Col 1</p>
<!-- /wp:paragraph -->
<!-- /wp:wp-bootstrap-blocks/column -->
<!-- /wp:wp-bootstrap-blocks/row -->

<!-- wp:wp-bootstrap-blocks/row -->
<!-- wp:wp-bootstrap-blocks/column {"sizeXs":8} -->
<!-- wp:paragraph -->
<p>Row 1 Col 1 &gt; Row 1-2 Col 1 </p>
<!-- /wp:paragraph -->
<!-- /wp:wp-bootstrap-blocks/column -->

<!-- wp:wp-bootstrap-blocks/column {"sizeXs":4} -->
<!-- wp:paragraph -->
<p>Row 1 Col 1 &gt; Row 1-2 Col 2</p>
<!-- /wp:paragraph -->
<!-- /wp:wp-bootstrap-blocks/column -->
<!-- /wp:wp-bootstrap-blocks/row -->
<!-- /wp:wp-bootstrap-blocks/column -->

<!-- wp:wp-bootstrap-blocks/column {"sizeXs":4} -->
<!-- wp:paragraph -->
<p>Row 1 Col 2</p>
<!-- /wp:paragraph -->
<!-- /wp:wp-bootstrap-blocks/column -->
<!-- /wp:wp-bootstrap-blocks/row -->

and here's the HTML output:

gh-issue-68-output

It seems to work for me. I can reload the editor without any issues. Can you maybe try to disable all other Gutenberg-related plugins in your setup and check if the issue still occurs? Or do you try to insert a specific block inside the columns which might break the blocks?

tschortsch commented 3 years ago

I will close this issue since I can't reproduce it. Please reopen it with further information if the issue still exists.