Last active
November 29, 2018 13:11
-
-
Save NielsPilon/eb47952fcf18bfe940748e16cb512613 to your computer and use it in GitHub Desktop.
ACF Gutenberg block render callback
This file contains 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 | |
function my_acf_block_render_callback( $block ) { | |
// convert name ("acf/testimonial") into path friendly slug ("testimonial") | |
$slug = str_replace('acf/', '', $block['name']); | |
// template bestand vanuit de "template-parts/block" map includen | |
if( file_exists(STYLESHEETPATH . "/blocks/content-{$slug}.php") ) { | |
include( STYLESHEETPATH . "/blocks/content-{$slug}.php" ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment