Skip to content

Instantly share code, notes, and snippets.

@royboy789
Created April 24, 2018 15: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 royboy789/1d6e69cd9d325557655fae72ae6e1dc0 to your computer and use it in GitHub Desktop.
Save royboy789/1d6e69cd9d325557655fae72ae6e1dc0 to your computer and use it in GitHub Desktop.
Using Gutenberg Block Data
<?php
get_header();
the_post();
$blocks = get_editor_blocks( $post->ID );
if ( empty( $blocks ) ) {
echo '<p>No Blocks Found</p>';
} else {
foreach( $blocks as $block ) {
$data = $block->data;
get_template_part( 'blocks/' . $block->name );
}
}
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment