PHP Filters
lzb/block_render/callback
Custom output callback for the block. See additional info on this article.
Attributes
Name | Type | Description |
---|---|---|
$result | String | block output |
$attributes | Array | block attributes |
$render_location | String | rendering location [editor , frontend ] |
$context | Array | block context data provided by parent blocks |
Additional Filters
Name | Description |
---|---|
BLOCK_SLUG/frontend_callback | specific block in the frontend only |
BLOCK_SLUG/editor_callback | specific block in the editor only |
BLOCK_SLUG/callback | specific block only |
Usage
function my_lzb_block_render_callback( $result, $attributes, $render_location, $context ) {
// Custom output for all blocks
return '<p>Custom Paragraph</p>';
}
add_filter( 'lzb/block_render/callback', 'my_lzb_block_render_callback', 10, 4 );
function my_lzb_block_render_callback( $result, $attributes ) {
// Custom output for block "lazyblock/my-custom-block"
return '<p>Custom Paragraph</p>';
}
add_filter( 'lazyblock/my-custom-block/callback', 'my_lzb_block_render_callback', 10, 2 );