Instantly share code, notes, and snippets.

What would you like to do?
ACF Gutenberg block render callback
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