Child Theme
A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.
Why use a Child Theme?
There are one main reason why you would want to use a child theme: if you modify a theme directly and it is updated, then your modifications WILL be lost. By using a child theme you will ensure that your modifications are preserved.
Installing the Child Theme
Log in to your site and go to “Dashboard > Appearance > Themes”. Click “Add New” and follow the directions to upload the graphis-child.zip file, located in the graphis_theme folder.
Next simply click “Activate” and both the Graphis theme and Graphis child theme will be active on your WordPress site. Now you’re ready to customize away.
Customizing Template Files
If you want to change more than just the stylesheet, your child theme can override any file in the parent theme: just include a file with the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads.
For instance, if you want to change the PHP code for the site header, you can include a header.php in your child theme’s directory, and that file will be used instead of the parent theme’s header.php.
Child Theme functions.php
Unlike style.css, the functions.php file of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. Specifically, it is loaded right before the parent’s file.
In that way, the functions.php of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme.
Adding PHP Functions
Say that you want to add a PHP function to your theme. The fastest way would be to open the graphis/functions.php file and put the function there… But that’s not smart: the next time Graphis is updated, your function will disappear (as the entire contents of the Graphis folder are replaced upon an update).
However, there is an alternative way which is the smart way: you can create a child theme, add a functions.php file in it, and add your function to that file. The function will do the exact same job from there too, with the advantage that it will not be affected by future updates of the parent theme.
Do not copy the full content of functions.php of the parent theme into functions.php in the child theme. It’s not a good practice by any means.