0

I've got this line in the functions.php of my Child theme:

require ( get_template_directory() . '/somecode.php' );

However it's giving me the following error:

Fatal error: require(): Failed opening required <path/to/parent/theme/somecode.php>

where path/to/parent/theme is actually the path of the Parent theme rather than the Child theme.

Any idea why?

1

get_template_directory() gives you the path to the parent theme while get_stylesheet_directory() gives you the path to the child theme.

Docs:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.