Including files in Child Themes

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?

Related posts

1 comment

  1. 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?

Comments are closed.