What is inherited by the Child Theme?

Hi there,

Just a quick question:

I finally got round to setting up a child theme for my website and it all seems to be working fine.

I had made a few changes to the parent’s theme functions.php before I downloaded the child theme. When I uploaded the child theme I noticed that this changes had gone.

Am I right in thinking that I need to re-add these changes, but to the child theme’s functions.php this time?

And should I from now on only make changes to the child theme section of the editor?

Thank you,
EW

Hey @riugn557,

That’s correct. The child theme’s functions.php file is loaded in addition to the parent functions.php file. If you don’t want to lose any of your modifications in the future you should put them in your child theme’s files, not the parent.

Check out this link for more info:
https://developer.wordpress.org/themes/advanced-topics/child-themes/#using-functions-php

Hello @riugn557,

Thanks for asking. :slight_smile:

  1. Parent theme function.php: Job of child theme is to inherit all the functionalities of parent theme. In that regards code you added into parent theme function.php file should work absolutely fine after activating child theme. As to why it’s not working or got removed automatically, need to seen bit more closely. Did you update the theme recently or after activating child theme? Because the code added in parent theme function.php file will get removed upon updating as the old theme files will get replaced with updated ones.

  2. My recomendatoin would be to add the code in child theme function.php file.

  3. You have the option to add the code or make necessary code changes from WordPress dashboard. What I prefer (it’s personal choice) is to use a code editor like Atom to make code changes and then upload the file using FTP programs like Filezilla to upload the files. You can also make the necessary modification in a code editor and then paste the code using WordPress theme editor section. At the end of the day, it’s a personal choice and what you are comfortable with. I have taken few software names, I am sharing the website links if you are interested in checking them out. These softwares are open source and completely free of charge:

  1. Atom Editor: https://atom.io/
  2. Filezilla: https://filezilla-project.org/

You can also check the getting started guide:

  1. Atom Editor: http://flight-manual.atom.io/getting-started/sections/atom-basics/
  2. Filezilla: https://codex.wordpress.org/Using_FileZilla

Thanks.

Hi there,

Thank you both for your detailed advice, I think that I have got everything working nicely now, but I’ll come back to this thread if I have any further questions about the child theme.

Cheers!
EW

You’re most welcome :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.