lazy-blocks icon indicating copy to clipboard operation
lazy-blocks copied to clipboard

Additional wrapper checkbox

Open paulkirspuu opened this issue 6 years ago • 2 comments
trafficstars

Could you make additional block markup wrapper voluntary, perhaps add a setting to "additional settings" section?

Talking about this, $allow_wrapper = apply_filters( $block['slug'] . '/' . $context . '_allow_wrapper', $result && 'frontend' === $context, $attributes );.

paulkirspuu avatar Mar 13 '19 11:03 paulkirspuu

I'd like to see this too. In the meantime, I've doing this but it's not very tidy:

// Stript the outer div from a block as it's breaking Bootstrap grid 
function wporg_strip_outer_div( $block_content, $block ) {
	if (substr($block['blockName'], 0, 10) == 'lazyblock/') {
		return preg_replace( '/^<[^>]+>|<\/[^>]+>$/', '', $block_content );
	} else {
		return $block_content;
	}
}
add_filter( 'render_block', 'wporg_strip_outer_div', 10, 2 );

martynbiz avatar Jun 02 '20 09:06 martynbiz

@martynbiz why are you doing this? We have PHP filters - https://lazyblocks.com/documentation/php-filters/lzb-block_render-allow_wrapper/

nk-o avatar Jun 10 '20 08:06 nk-o