Home » WordPress » Creating a WordPress child theme

Creating a WordPress child theme

As a WordPress developer you will need to get to grips with modifying the themes you are using for a website during its design. Child versions of themes are very important if you do modify a theme and wish to avoid losing your code during an update of the parent theme.

Create a folder on your webserver in the /wp-content/themes folder using FTP or your hostings file manager.  For example if the theme you are using is “twentyseventeen” and is set up in:

/wp-content/themes/twentyseventeen

then create

/wp-content/themes/twentyseventeen-child

In this folder create a  file called style.css and into the file place the following  code:

 

/*
 Theme Name:   Twenty Ten Child
 Theme URI:    https://yoursite.com/twenty-ten-child/
 Description:  Twenty Ten Child Theme
 Author:       Yourself
 Author URI:   https://example.com
 Template:     twentyseventeen
 License:      GNU General Public License v2 or later
 License URI:  https://www.gnu.org/licenses/gpl-2.0.html
*/
@import url("../twentyseventeen/style.css");
Simply add you replacement/overriding css here.

You may also place any modified files such as header.php, footer.php, sidebar.php in here too. These will overide the equivalent in the parent theme.

 

Change the theme to the child in the Appearance menu on the WordPress desktop.

Support