WordPress.org

Ready to get started?Download WordPress

Forums

Original functions.php in child theme? (3 posts)

  1. Inserat
    Member
    Posted 1 year ago #

    Regarding a Twentytwelve child theme and the functions.php file.

    Usually, I have been putting any files I want to alter, in my child theme folder, in order to preserve the original theme intact. In this case I've (successfully) created a child theme for the Twentytwelve theme. However, when I copy the original functions.php file from Twentytwelve to my child theme folder, I get heaps of PHP errors. Essentially, I can't seem to do this with Twentytwelve, as I have done numerous times with other themes.

    What I would very much like to do is to keep the functions.php file intact in it's original location (obviously), while at the same time being able to edit key parts of functions.php within my child theme (translation, for instance, alongside some minor PHP tweaks here and there).

    As I have never encountered this behaviour with previous themes, I have no clue what I should do. Following the Codex article on child themes does not seem to apply here, albeit functions.php file is listed as optional in the article. It's a bit confusing nonetheless.

    Any help would be greatly appreciated, thanks!

    Vp

  2. kmessinger
    Volunteer Moderator
    Posted 1 year ago #

    You should only put your changes in the child theme. As I understand it, if you duplicate the functions file completely things will happen twice, at different times and that is why the errors.

    And when an upgrade comes and the original functions.php is replaced, you will have the old one (which loads first) in your child theme.

  3. Inserat
    Member
    Posted 1 year ago #

    Thank you kmessinger. That's what I thought.

    In any event, what I have to do is to "extract" the functions that I want in the functions.php of my child theme. I tried that before posting above, and it too gave me PHP errors. My PHP skills are not mad... I'll keep trying anyway!

    Thanks again for clearing that up!

    Cheers!

    Ins.

Topic Closed

This topic has been closed to new replies.

About this Topic