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