Functions.php in a Child Theme
-
I’m using the Twenty Eleven theme and I am trying to alter the functions of my website. I have followed the very basic example in the Codex on how to use the functions.php file in a child theme. It is designed to add a favicon.
https://codex.www.ads-software.com/Child_Themes
It works, in that it adds the favicon but it breaks other aspects of the site: after I had created the functions.php file in the child theme as directed, I went into the admin side of the site and unticked “email me whenever anyone posts a comment”. But when I went to save the settings i got this error:
Warning: Cannot modify header information - headers already sent by (output started at /.../wp-content/themes/geeks/functions.php:11) in /.../wp-includes/pluggable.php on line 934
I am not sure why this happens but it seems to be confused between the original functions.php and the new one I added to the child theme. Do I need to add more code to the child function.php to get it to return to the original function.php or something?
Looking at the instructions in the Codex at the link given above, it says:
An opening PHP tag at the top, a closing PHP tag at the bottom, and, between them, your bits of PHP.
However, looking at the twenty eleven functions.php file it can be seen that there is no such closing php tag. So is a closing php tag required or not? If it is, then why does the default functions.php file not have one?
- The topic ‘Functions.php in a Child Theme’ is closed to new replies.