Created
April 20, 2023 07:40
-
-
Save annelyse/acb7d1ce83bd8b3cb6ed7258bb2a9950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gutenberg_examples_dynamic() { | |
// automatically load dependencies and version | |
register_block_type( 'custom-e2s/bloc-left', array( | |
'api_version' => 2, | |
'render_callback' => function($attributes, $content ) { | |
$path = locate_template( 'templates/blocks/bloc-left.php' ); | |
if ( file_exists( $path ) ) { | |
ob_start(); | |
echo get_template_part( | |
'templates/blocks/bloc-left', | |
null, | |
array( | |
$attributes, $content | |
) | |
); | |
$block = ob_get_contents(); | |
ob_end_clean(); | |
return $block; | |
} | |
} | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment