1

Twenty Thirteen uses the following in functions.php: require( get_template_directory() . '/inc/custom-header.php' );. When I copy /inc/custom-header.php to twentythirteen-child, it isn't replaced. I can't use require() because two copies will be included. How this should be handled?

2

get_template_directory looks in the parent theme for files.

In the case a child theme is being used, the absolute path to the parent theme directory will be returned. Use get_stylesheet_directory() to get the absolute path to the child theme directory.

http://codex.wordpress.org/Function_Reference/get_template_directory

This file is not meant to be replaced. You will need to find another way to do what you need to do.

Perhaps remove the function hooked here and add your own?

  • I know about these functions but what if I need to replace contents of that particular file? So, Child Themes are only meant to allow editing of CSS and main template files? I can't update shortcode in its PHP file or modify custom-header.php mentioned above? – Paul Jun 6 '13 at 14:41
  • As I said, the file is not meant to be replaced. You can't replace it. Yes, only some files are replaceable. – s_ha_dum Jun 6 '13 at 14:48
  • Okay! I see it now. Indeed, I'll use hooks to replace such functionality. Too bad that not everything can be replaced. – Paul Jun 6 '13 at 14:54

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.