WordPress.org

Ready to get started?Download WordPress

Forums

Functions.php in child theme (6 posts)

  1. ksteingrandt
    Member
    Posted 2 years ago #

    Hi all

    I am working with a child theme of twenty eleven and everything is hunky dory, except the functions.php file.

    The problem is that if I put my modified functions.php into my child theme's folder, the site breaks. If I put that exact same modified functions.php in the original twentyeleven folder, the site works fine (don't worry - I've kept a copy of the original twenty eleven functions.php!!).

    What gives? Why is my site breaking when I put functions.php into my child theme folder, but works fine in the original twenty eleven folder? Is there a conflict between the original twenty eleven functions.php and the one in my child theme? Is there something I need to comment out?

    I should mention that I'm pretty much a php/Wordpress noob :)

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    the site breaks

    what is the error message?

    what code do you have in functions.php of the child theme?

    ( please use the http://pastebin.com/ - see: http://codex.wordpress.org/Forum_Welcome#Posting_Code )

  3. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    My guess is that you're trying to rewrite a function that isn't within a conditional if... endif or you're trying to redefine a constant instead of adding to the appropriate filter.

    EDIT: Or it could just be a missing opening <?php tag.

  4. (don't worry - I've kept a copy of the original twenty eleven functions.php!!)

    You're not copying the original twentyeleven/functions.php into the child theme directory are you?

    If you are don't do that: you only need to put new functions in the child theme copy.

  5. ksteingrandt
    Member
    Posted 2 years ago #

    I think Jan may have nailed it...I'm putting the entire functions.php (with my changes mixed in with the original code) in the child theme's folder.

    Given that info, would I now just find the lines that I changed, put them in a new file, name that functions.php and put that into the child theme's folder?

  6. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    I'm putting the entire functions.php (with my changes mixed in with the original code) in the child theme's folder.

    Nooo! Never do that. You only add new/amended functions to your child theme's functions.php file.

    Find the functions that you changed and add just these changed functions to your child.

Topic Closed

This topic has been closed to new replies.

About this Topic