Blocks Code
Theme Template
Output Method "Theme Template" works with php templates, placed in your theme folder.
The block template needs to be stored in a file in the /blocks/
directory in your theme, using the slug of your block in the filename.
For example, if your block's slug is lazyblock/blockquote
, Lazy Blocks will look for a block template in your theme in this location: wp-content/themes/{YOUR_THEME}/blocks/lazyblock-blockquote/block.php
. It will first check if the template exists in the child theme, and if not, then in the parent theme.
You may also define specific template, that will be loaded in editor only. Place it here – wp-content/themes/{YOUR_THEME}/blocks/lazyblock-blockquote/editor.php
Template file example:
block.php
<?php
/**
* Example Block Template.
*
* @var array $attributes Block attributes.
* @var array $block Block data.
* @var string $context Preview context [editor,frontend].
*/
?>
<div class="my-test-block">
<?php echo esc_html( $attributes['select'] ); ?>
</div>