Support

Account

Home Forums Add-ons Flexible Content Field Conditionally Show Flexible Content Layout Reply To: Conditionally Show Flexible Content Layout

  • If you’re doing a parent theme -> child theme framework.

    You can make your fields and create separate directories for each of the json files in the parent theme.

    
    acf/library/fields.json
    acf/slideshow/fields.json
    acf/accordion/fields.json
    

    In the child themes functions.php you can set custom load directories.

    
    function acf_json_load_paths( $paths ) {
    
      // Loads alls json files from the /acf-json folder in the child theme
      $paths = array(get_template_directory() . '/acf-json');
    
      // If this theme is a child theme it will load all the fields in the acf-json/library directory
     
      if(is_child_theme()) {
        $paths[] = get_stylesheet_directory() . '/acf-json/library';
      }
    
      return $paths;
    
    }
    add_filter('acf/settings/load_json', 'mw_acf_json_load_paths');
    

    Not sure if this the right solution.