Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created Jul 14, 2020
Embed
What would you like to do?
<?php
function be_get_block( $blockName = '' ) {
global $post;
$blocks = parse_blocks( $post->post_content );
foreach( $blocks as $block ) {
if( $blockName === $block['blockName'] )
return render_block( $block );
}
// Example Usage
echo be_get_block( 'core/quote' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment