Support

Account

Home Forums Add-ons Flexible Content Field Adding additional layout to flexible_content field in child theme Reply To: Adding additional layout to flexible_content field in child theme

  • Having a field group defined in the parent theme and then adding to it in a child theme is not something there is any documentation on, or something that I’ve done. If I were going to do this I would.

    1) Create a function in my parent theme that creates the needed field group.
    2) Create a custom hook that will allow me to filter that field group.

    something like this

    
    // in parent theme
    add_action('acf/include_fields', 'parent_theme_group');
    function parent_theme_group() {
      $field_group = array(
        // definition of field group here
      );
      $field_group = apply_filters('my_custom_hook_name', $field_group);
      acf_add_local_field_group($field_group);
    }
    
    
    // in the child theme
    add_filter('my_custom_hook_name', 'add_to_parent_theme_group');
    function add_to_parent_theme_group($group) {
      // modify $group
      return $group;
    }