Support » Fixing WordPress » Error in functions.php while making childtheme from edited parent

  • Hello people,

    Old situation: Made alterations directly to the twentytentheme

    Desired new situation: a working childtheme, everything working/looking exactly like I made the altered twentytentheme

    Since I had edited not only style.css but also header.php and other files in my parent-theme, I copied all of the files in themes/twentyten to my new child themefolder themes/twentytencobi. In style.css in my child theme I changed the header acoording to a tutorial, this style.css seems to wotk fine.

    But: when I activate my childtheme, the following error-message appears:

    Fatal error: Cannot redeclare twentyten_page_menu_args() (previously declared in /public/sites/ in /public/sites/ on line 217

    As I have searched/googled for answers, I now have a slight idea of what is causing this error, but no idea as to how to resolve it in my specific case. So, I was hoping maybe one of you could help me out?

    The code in functions.php in both parent- and child-theme are at this point as follows:

    my website is here: (now back to “old”, directly edited twentytentheme).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The Theme Gurus are more likely to be looking here:

    So, if you don’t get an answer in the next couple of hours, I would re-post there.



    Forum Moderator

    i wouldn’t.
    double posting or bumping does not get you any more responses than sticking with your one thread.

    functions.php is the one template file that cannot be copied fully into a child theme.

    in functions.php of twenty ten, there are some functions, that are preceded by a line of code, for instance: if ( ! function_exists( 'twentyten_setup' ) ):
    with these, you can re-define/re-use the function (name) in your child theme.

    other functions as the one that created your error message,
    (for instance: function twentyten_page_menu_args( $args ) { )
    are directly defined just for the parent theme, and cannot be re-used in the child theme.
    this particular function is used in a filter, and you can define a new function in the child theme to influence the filter, if you need.

    so, if you have modified functions.php of the twenty ten before creating the child theme, you have to check carefully how you can transport these changes into your child theme so that your child theme works the same way as your modified twenty ten (even after the wtenty ten is replaced with a fresh copy).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error in functions.php while making childtheme from edited parent’ is closed to new replies.