Created
October 29, 2018 05:42
-
-
Save digisavvy/ea1c652084fdc72b45101fa347720ccb to your computer and use it in GitHub Desktop.
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
| /** | |
| * Render Gutenberg Block Template | |
| */ | |
| function my_acf_block_render_callback( $block ) { | |
| // convert name ("acf/testimonial") into path friendly slug ("testimonial") | |
| $slug = str_replace('acf/', '', $block['name']); | |
| // include a template part from within the "template-parts/block" folder | |
| if( file_exists(plugin_dir_path( __FILE__ ) . "/views/block-{$slug}.php") ) { | |
| include( plugin_dir_path( __FILE__ ) . "/views/block-{$slug}.php" ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment