PHP Filters
lzb_pro/block_script/template
Filters block script template path for custom JavaScript functionality of blocks.
This filter allows you to customize the template path used for block scripts in Lazy Blocks Pro.
Attributes
Name | Type | Description |
---|---|---|
$template | String | block script template path |
$template_name | String | template name |
$block | Array | block data |
$context | String | rendering context [editor , frontend ] |
Additional Filters
Name | Description |
---|---|
BLOCK_SLUG/frontend_script_template | specific block in the frontend only |
BLOCK_SLUG/editor_script_template | specific block in the editor only |
BLOCK_SLUG/script_template | specific block only |
Usage
function my_lzb_pro_block_script_template( $template, $template_name, $block, $context ) {
// Custom script template for all blocks
return '/YOUR_CUSTOM/SCRIPT/PATH.js';
}
add_filter( 'lzb_pro/block_script/template', 'my_lzb_pro_block_script_template', 10, 4 );
function my_lzb_pro_block_script_template( $template, $template_name, $block, $context ) {
// Custom script template for specific block
if ( $block['slug'] === 'my-custom-block' ) {
return '/YOUR_CUSTOM/SCRIPT/PATH.js';
}
return $template;
}
add_filter( 'lzb_pro/block_script/template', 'my_lzb_pro_block_script_template', 10, 4 );
function my_lzb_pro_block_script_template( $template, $template_name, $block ) {
// Custom script template for block "my-custom-block"
return '/YOUR_CUSTOM/SCRIPT/PATH.js';
}
add_filter( 'my-custom-block/script_template', 'my_lzb_pro_block_script_template', 10, 3 );