I was creating a child theme today and needed to overwrite a php file which was included using this code in the themes functions.php file
require_once( get_template_directory() . '/function-includes/theme-functions.php' );
I tried using require_once( get_stylesheet_directory(). '/function-includes/theme-functions.php' );
in my child themes functions file but it caused an error and didn’t load the site at all.
So I ended up using locate_template( '/function-includes/theme-functions.php', true );
in the parent themes functions.php file
Is locate_template
a better method for theme developers to use to allow child theme development?
Is there an alternative way for me to use only my child themes functions.php to overwrite that theme-functions.php file?