PHP Filters
lzb/block_render/include_template
Filters block template path for https://www.lazyblocks.com/docs/blocks-code/theme-template/.
Used in combination with https://www.lazyblocks.com/docs/php-filters/lzb-block_render-template_exists/.
Attributes
Name | Type | Description |
---|---|---|
$template | String | block template path |
$attributes | Array | block attributes |
$block | Array | block data |
$context | String | rendering context [editor , frontend ] |
Additional Filters
Name | Description |
---|---|
lazyblock/BLOCK_SLUG/frontend_include_template | specific block in the frontend only |
lazyblock/BLOCK_SLUG/editor_include_template | specific block in the editor only |
lazyblock/BLOCK_SLUG/include_template | specific block only |
Usage
PHP
function my_lzb_block_render_include_template( $template, $attributes, $block, $context ) {
// Custom template for all blocks
return '/YOUR_CUSTOM/BLOCK/PATH.php';
}
add_filter( 'lzb/block_render/include_template', 'my_lzb_block_render_include_template', 10, 4 );
PHP
function my_lzb_block_render_include_template( $template, $attributes, $block, $context ) {
// Custom template for block "lazyblock/my-custom-block"
return '/YOUR_CUSTOM/BLOCK/PATH.php';
}
add_filter( 'lazyblock/my-custom-block/include_template', 'my_lzb_block_render_include_template', 10, 4 );