I am trying something basic but I can't seem to figure it out or I am not even sure if it is possible to be done in a child theme.
What is am trying is to organize the the codes in the functions.php file in the child theme by creating a separate directory for include files and have all the files in there.
Basically, here is the code in my functions.php file:
require_once( get_stylesheet_directory_uri() . '/inc/myfile.php');
And then myfile.php got this code:
function myfunction( $src ) {
}
add_filter( 'script_loader_src', 'myfunction');
But then I get this error:
PHP Fatal error: Call to undefined function add_filter()
So now I am wondering if there is a way for me to do what I am trying to achieve in a child theme. I have tried this approach in a parent theme and it seemed to work fine.
Thanks in advance for explanation and suggestions.