• Resolved Mayapur Voice

    (@mayapurvoice)


    I am using a child theme (from The Newswire). Today I edited the functions.php file for some reason and it stopped working. I started getting errors while loading wp-admin. I copied the file from the original theme. I understand that by doing this I lose some work. The problem now is, it doesn’t load the admin panel apparently because both the themes (main and its child) have the same functions.php file. I am able to work if I rename the main theme’s functions.php. Is it safe to do like this? Will it affect if the theme gets an update? Pl let me know. Hare Krishna

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    while all other files in your child-theme folder “replaces” the same files in the main-theme folder when you add them, the code of the functions.php in your child-theme is “added” to the code of the functions.php of the parent theme. That means if you need new functionality that goes to the functions.php just put the new/additional code into your child theme functions.php.
    Usually the parent functions.php refers to other files (using the include function) so you can’t just copy the whole parent functions.php to your child folder.

    Hope that makes sense a bit.

    Thread Starter Mayapur Voice

    (@mayapurvoice)

    Thanks for the comments. Yes it did help understand a bit how things work. But it was easier for me to reinstall wordpress on another directory, back up the posts / pages from the frist location and restore it in the second one. Some manual stuff had to be done but I got a clean site now. Hare Krishna

    The WordPress Codex explains this pretty well, pay close attention to the paragraph right before the code block.

    To extend functions php in your child theme. Create a new document in your child themes root named functions.php In this file add the following …

    <?php //Opening PHP tag
    
    /* custom PHP functions below this line */
    
    ?> //Closing PHP tag

    Good Luck ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘functions.php’ is closed to new replies.