Javier Rodriguez

Menu

inc-acf.php

FRAMEWORK 2024-05-31

<?php
/**
 * functions/inc-acf.php
 * 
 * ACF Blocks Json Auto Register
 * 
 * @author JJROD Framework
 * @see https://docs.jjrod.com
 * @version 1.0
 */
  
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/* Remove Innerblocks HTML */
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
add_filter( 'acf/blocks/wrap_frontend_innerblocks', 'acf_should_wrap_innerblocks', 10, 2 );
function acf_should_wrap_innerblocks( $wrap, $name ) {
    if ( $name == 'acf/test-block' ) {
        return true;
    }
    return false;
}

/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/* Auto Register ACF Blocks */
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
// Register Custom Blocks
add_action('acf/init', 'tbc_register_blocks');
function tbc_register_blocks() {

    // check function exists.
    if( function_exists('acf_register_block_type') ) {

        /**
        * JSON Includes
        */
        require get_template_directory() . '/blocks/register-blocks.php';

     
    }
}

?>