How to setup a child theme in WordPress

Most of the time it is a really good idea to use an existing, established theme for your WordPress website instead of building a design from scratch yourself. Setting up a so called child theme can help you to add modifications to the underlying theme without loosing the possibility to update the theme to the most recent version or at least not making this process any harder than it should be.

Setting up the child theme

If you selected a parent theme and want to make changes to it, you can follow a few simple steps to create a child theme that holds your modifications.

First, create a folder under wp-content/themes for your child theme. For example create a directory with the name of your client that you are currently working for.

Then place a file style.css with the following content in this newly created folder:

/*
 *  Theme Name:   my-client-name
 *  Description:  My Client Name
 *  Author:       Christian Schenk
 *  Template:     page-builder-framework
 *  Version:      1.0.0
 *  Text Domain:  my-client-name
 */

The most important row starts with “Template” and holds the name of the parent template you selected. It’s the excellent page-builder-framework in this example.

After activating your child theme in the WordPress backend your child theme should be working already and you can start adding custom CSS or PHP code to it. If it does not work as expected and if the CSS got lost in particular you might have to enqueue the style.css from the parent theme in your function.php first. Please have a look at the documentation on wordpress.org for this.

Conclusion

To end this short introduction to child themes I can say that setting up a child theme in WordPress is easy and provides a clean way for you to add modification to existing themes.