Thread Starter
kubiq
(@kubiq)
ANOTHER PRODUCTIVITY TIP:
After ROW is added then user mostly wants to select column layout and then continue with other content.
NOW:
To do that I have to go 1 level up as first column is focused and not row, then I have to open layouts (in newest version it is open – GREAT!)
WANTED:
After row is created, row should be in focus, so you can directly select column layout from opened layouts offer
Hi @kubiq. Thanks for your input!
We have to look into the auto-sized columns. Would be a cool feature indeed but is not that easy to implement (because of how the columns are styled in the editor right now). But it’s on our list.
Adding an own layout (7 cols / centered) is already possible with the available filters:
1. Add template (with JavaScript filter)
wp.hooks.addFilter( 'wpBootstrapBlocks.row.useOldObjectTemplateStructure', 'myplugin/wp-bootstrap-blocks/row/useOldObjectTemplateStructure', () => false );
function myRowTemplates( templates ) {
templates = [
...templates,
{
name: '1col-7width',
title: 1 Column (7 width)',
templateLock: 'all',
template: [
[
'wp-bootstrap-blocks/column',
{
sizeMd: 7,
},
],
],
},
];
return templates;
}
addFilter( 'wpBootstrapBlocks.row.templates', 'myplugin/wp-bootstrap-blocks/row/templates', myRowTemplates );
2. Set default block attributes (with PHP filter)
function myplugin_wp_bootstrap_blocks_row_default_attributes( $row_default_attributes ) {
$row_default_attributes['template'] = '1col-7width';
$row_default_attributes['alignment'] = 'center';
return $row_default_attributes;
}
add_filter( 'wp_bootstrap_blocks_row_default_attributes', 'myplugin_wp_bootstrap_blocks_row_default_attributes' );
This should add your template as needed.
About the backgrounds: We know that the current solution is not ideal. We added the background colors to visualize the col blocks. We’ll try to improve that!
And the 80% style for the container was also just there to visualize that the blocks inside are wrapped in a container. Again not the best solution.
Thread Starter
kubiq
(@kubiq)
Thank you, I just found these filters and it’s really useful π
@kubiq We just released v1.4.0 of the plugin. In this version we removed the container width in the editor. We also removed the background-colors of the row & column blocks in the editor (we only show them when hovering over the block).
Thread Starter
kubiq
(@kubiq)
great! so I can remove my CSS hacks from theme π thanks
Ah, and I forgot to mention that the plugin now supports equal width columns as requested.
Thread Starter
kubiq
(@kubiq)
great π so it is like col-md right? Or it is like col-md-auto?
If I understand it correctly then -auto is still missing? Or it is when I set column to 0 (zero)? …nevermind I will try it tomorrow, thanks π