Skip to content

Instantly share code, notes, and snippets.

@NielsPilon
Last active November 29, 2018 13:11
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 NielsPilon/eb47952fcf18bfe940748e16cb512613 to your computer and use it in GitHub Desktop.
Save NielsPilon/eb47952fcf18bfe940748e16cb512613 to your computer and use it in GitHub Desktop.
ACF Gutenberg block render callback
<?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