Support

Account

Home Forums General Issues Problem with theme Child Creation Reply To: Problem with theme Child Creation

  • Ok, I have find a solution 😀

    This is the code (file functions.php theme master) that you must use if you want to include in a theme acf and expect the opportunity to create a child theme:

    
    /*ACF*/
    // 1. customize ACF path
    add_filter('acf/settings/path', 'my_acf_settings_path');
    function my_acf_settings_path( $path ) {
        $path = get_template_directory() . '/acf/';
        return $path;
    }
    
    // 2. customize ACF dir
    add_filter('acf/settings/dir', 'my_acf_settings_dir');
     
    function my_acf_settings_dir( $dir ) {
        $dir = get_template_directory_uri() . '/acf/';
        return $dir;
    }
     
    // 3. Hide ACF field group menu item
    if ( ! has_filter( 'acf/settings/show_admin' ) ) {
    	add_filter('acf/settings/show_admin', '__return_false');
    }
    // 4. Include ACF
    include_once( get_template_directory() . '/acf/acf.php' );
    

    If you want to show the Options menu ACF in child theme, use the following filter (file functions.php theme child):

    add_filter('acf/settings/show_admin', '__return_true');

    I hope this can be helpful as it was for me 🙂