Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created July 14, 2020 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/773d92e2ba2a50badaed5d543d31bc21 to your computer and use it in GitHub Desktop.
Save billerickson/773d92e2ba2a50badaed5d543d31bc21 to your computer and use it in GitHub Desktop.
<?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