A WordPress child theme is a theme that inherits the functionality of parent theme. Child theme allows you to modify, or add to the functionality of that parent theme.
Create a directory in themes directory to hold the child theme. You should name the directory without any space as part of the name, and it is common practice to use the name of the parent theme folder with “-child” appended to it. For example, if you are making a child of the “mytheme” theme, your folder name would be “mytheme-child”.
In the child theme directory, create a file called style.css. This is the only file required to make a child theme. The style sheet must start with the following lines:
Theme Name: MyTheme Child
Theme URI: http://mysite.com/mytheme-child/
Description: MyTheme Child Theme
Author: John Doe
Author URI: http://mysite.com
/* =Theme customization starts here
Unlike style.css, the functions.php 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.)
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.