WordPress.org

Ready to get started?Download WordPress

Forums

...Headers already sent (4 posts)

  1. Runtheball
    Member
    Posted 2 years ago #

    I'm trying to create a child theme for twentyeleven. I'm creating a new (initially blank) functions.php file and keeping it inside the child theme directory. When I paste some code in that file to modify the twentyeleven functions.php file, I get the following when I update pages...
    Warning: Cannot modify header information - headers already sent by (output started at xxxxxxx/wp-content/themes/ETJchildtheme/functions.php:40) in xxxxxxxxx/wp-includes/pluggable.php on line 934

    What do I do about that?

  2. Runtheball
    Member
    Posted 2 years ago #

    Found the answer in another post with similar title to mine:

    The problem here is that you have gotten some text or whitespace (spaces, newline) before the opening PHP tag or after the closing PHP tag in your theme's functions.php file. There can't be a single character before or after those tags.

    Thanks Stvwlf...wherever you are.

  3. Xam 1.0
    Member
    Posted 2 years ago #

    Look at functions.php line 40, see what it says.

    -edit > problem fixed > nevermind-

  4. Lisa Sabin-Wilson
    Member
    Posted 2 years ago #

    Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

    http://codex.wordpress.org/Child_Themes#Using_functions.php

    What this means for child theme development is that any functions you include in your CHILD THEME functions file cannot duplicate any functions that already exist within the PARENT THEME functions.php. If you have duplicate functions, you will get the dreaded "Headers already sent" error message.

    Start with a blank functions.php file in your CHILD THEME, and the error should go away. Then, do some research on Google and in the WP Codex on modifying the functions, using hooks and such...build from there.

    Hope that helps!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.