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
add_action('acf/init', function() { | |
if( function_exists('acf_register_block') ) { | |
// Look into views/blocks | |
$dir = new \DirectoryIterator(\locate_template("views/blocks/")); | |
// Loop through found blocks | |
foreach ($dir as $fileinfo) { | |
if (!$fileinfo->isDot()) { | |
$slug = str_replace('.blade.php', '', $fileinfo->getFilename()); | |
// Get infos from file | |
$file_path = \locate_template("views/blocks/${slug}.blade.php"); |