Skip to content

Instantly share code, notes, and snippets.

@jstask82
Last active May 18, 2024 13:16
Show Gist options
  • Save jstask82/ec69915874aa4e72a4c42b3402a14a72 to your computer and use it in GitHub Desktop.
Save jstask82/ec69915874aa4e72a4c42b3402a14a72 to your computer and use it in GitHub Desktop.
function mb_block_renderer($attributes, $block)
{
$context = Timber::context();
$context['attributes'] = $attributes;
$context['is_preview'] = defined('REST_REQUEST') && REST_REQUEST;
$context['post_id'] = get_the_ID();
$context['PREFIX'] = PREFIX;
$block_name = end(explode('/', $block->name));
Timber::render("blocks/{$block_name}.twig", $context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment