Library for Custom Dynamic Block.
$file_or_folder
: Path to the JSON file with metadata definition for the block or path to the folder where the block.json
file is located.
$args
: Optional. Array of block type arguments.
$dynamic_block = new HAMWORKS\WP\Dynamic_Block\Dynamic_Block( __DIR__ );
wp-content/themes/your-theme/template-parts/blocks/block-namespace/blockname.php
- template-parts/blocks/block-namespace/blockname-blockstyle.php
- template-parts/blocks/block-namespace/blockname.php
use HAMWORKS\WP\Dynamic_Block\Dynamic_Block;
add_filter( "hw_dynamic_block_template_arguments_to_{$block_name_in_block_json}", function ( array $arguments, array $attributes, Dynamic_Block $block_instance ) {
$arguments['foo'] = 'bar';
return $arguments;
}, 10, 3 );