Support » Themes and Templates » Header.php in a Twenty Ten Child Theme

  • Hi,

    Why do I encounter a blank white page that includes only text (as if there is no CSS file) when you add a Header.php file to a Child Theme of Twenty Ten?

    My Child Theme example is basic:

    Footer.php (includes <?php wp_footer();?>)

    And it works fine, it does what I need into do. But when I add the following Header.php, which I add as most plugins need <?php wp_head();?>

    The site looses all Style and becomes a white page with only text.

    Can someone tell me why I encounter this behaviour after adding a Header.php file with only the following code<?php wp_head();?>

    Many Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • because you are missing all the important items from the header.

    You need all the stuff in header.php, from the first line, to the </head> tag

    Or at least most of it……
    it tells the browser your doctype. html profile, calls in your css, etc

    I see,

    So just to check, I can have a footer.php file containing just <?php wp_footer();?>
    and it’s good to go or is there also necessary code missing?

    My intentions are just based on using a child theme but making sure wp_footer & wp_head are included.

    At the same time I know that the required blank functions.php with <?php?> pulls all the functions through.

    I notice some plugins are affected when I use just the functions.php file; for example, to fix problems like an animated calender pop up not showing I must add a footer.php file with <?php wp_footer();?> anf hey presto it’s fixed.

    I have a similar question, I am new to child themes.

    If I want to edit header.php, I create a header.php (with nothing in it) in the child theme, but everything goes blank.

    Do I need to copy all of the code from the parent to the child?

    Hi PiManIII

    Read this page it explains all you need to know

    The blank child header function loads in addition to the parent functions. If I need to add a Header.php file to the child theme; I ensure that it is customized and different to the parent. This will allow you to upgrade the parent theme without loosing any customizations.



    Hi guys,
    what I’ve done was to copy the whole header.php to the heade.php of the child theme and then added the scripts I needed.
    It works great, do you think this is the best way to do this?


    @ray, that is exactly how it’s done.

    Any file placed in the child theme loads in place of the parent theme.

    So if you put a header.php in your child theme, it is used, and the parent is ignored

    Same thing for index.php, page.php, etc.

    (style.css and functions.php are exceptions to this rule)

    Then how do updates to WP take effect in a Child theme if you are using a Child Theme of say, TwentyTen? Won’t the child theme simply override any updates?

    Thanks in advance!

    THat is correct…. the problem with a child theme is that you may not benefit from a theme update.

    But the point of the child theme is that you can make edits through the child theme safely.

    So you balance the pros and cons. I personally always redo the header.php in the above manner as I tend to heavily customize my site headers

    I’m using twentyeleven as my parent theme, so when an update comes through, I do a comparison of the update to see what has changed. It’s not hard to look at the changelog and see what has changed. If anything were to have changed which is important, I would include the change on my child theme.

    That doesn’t happen often, I’ve never needed to edit any of my child theme files for such a reason.

    Awesome! Thank you!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Header.php in a Twenty Ten Child Theme’ is closed to new replies.