Skip to content
PHP Filters

lzb_pro/block_style/template

Filters block style template path for custom styling of blocks.

This filter allows you to customize the template path used for block styles in Lazy Blocks Pro.

Attributes

NameTypeDescription
$templateStringblock style template path
$template_nameStringtemplate name
$blockArrayblock data
$contextStringrendering context [editor, frontend]

Additional Filters

NameDescription
BLOCK_SLUG/frontend_style_templatespecific block in the frontend only
BLOCK_SLUG/editor_style_templatespecific block in the editor only
BLOCK_SLUG/style_templatespecific block only

Usage

PHP
function my_lzb_pro_block_style_template( $template, $template_name, $block, $context ) {
  // Custom style template for all blocks
  return '/YOUR_CUSTOM/STYLE/PATH.php';
}
 
add_filter( 'lzb_pro/block_style/template', 'my_lzb_pro_block_style_template', 10, 4 );
PHP
function my_lzb_pro_block_style_template( $template, $template_name, $block, $context ) {
  // Custom style template for specific block
  if ( $block['slug'] === 'my-custom-block' ) {
    return '/YOUR_CUSTOM/STYLE/PATH.php';
  }
  return $template;
}
 
add_filter( 'lzb_pro/block_style/template', 'my_lzb_pro_block_style_template', 10, 4 );
PHP
function my_lzb_pro_block_style_template( $template, $template_name, $block ) {
  // Custom style template for block "my-custom-block"
  return '/YOUR_CUSTOM/STYLE/PATH.php';
}
 
add_filter( 'my-custom-block/style_template', 'my_lzb_pro_block_style_template', 10, 3 );

Was this article helpful?