Created
April 24, 2018 15:57
-
-
Save royboy789/1d6e69cd9d325557655fae72ae6e1dc0 to your computer and use it in GitHub Desktop.
Using Gutenberg Block Data
This file contains hidden or 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
<?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