Are you using WordPress? Yes? Are you using a free theme from WordPress? Yes? Do you make any modifications to the theme? Yes? Do you feel annoyed whenever you update the theme and your modifications are gone? Yes? If so, you really should use a WordPress child theme.

According to WordPress, 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”. So it’s not only useful to use in the above situation but also when you buy a theme somewhere, make some customizations, and then one day when the sky is blue and clear, they have updates for your theme.

For example, I’m using the Fictive theme for this site. The theme’s directory in `/wp-content/themes` folder is `fictive`:

$ ls
fictive  index.php

Now make the child theme directory:

$ mkdir fictive-child

Remember that your child theme folder name should be the parent theme’s name followed by `-child`.

I just need to edit some CSS styles, so I copy `style.css` from the parent theme to child theme and edit it:

$ cp fictive/style.css fictive-child/

We also copy the `screenshot.png` file so that the child theme would appear in the theme management page:

$ cp fictive/screenshot.png fictive-child/

To make the child theme work, you need to update the new `style.css` file with some tags in the header:

/* Theme Name: Fictive Child
 * Theme URI: https://wordpress.com/themes/fictive/
 * Author: Automattic
 * Author URI: https://wordpress.com/themes/
 * Description: Fictive is all about you -- your style, your look, your story. Make it personal with a custom header image, a Gravatar, and links to your favorite social networks. Use Post Formats to dress up your content, add a custom menu and widgets, or keep it simple with a fixed-position header.
 * Version: 1.1.1
 * Template: fictive
 * License: GNU General Public License v2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: fictive-child
 * Tags: brown, orange, blue, red, two-columns, left-sidebar, fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, featured-images, flexible-header, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready
/* =Reset

In the example above, I change Theme Name, Text Domain values to `Fictive Child` and `fictive-child`, respectively.

Now navigate to Themes page, you can see the new child theme:

Themes show up in WordPress
Themes show up in WordPress

Now click Activate on the new theme and start customizing your theme. Next time you update the theme the changes will not disappear. For more information you can check the official document from WordPress here: https://codex.wordpress.org/Child_Themes.