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;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.