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.
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.