A child theme lets you customise an existing WordPress theme without losing your changes when the parent theme updates. Every time the parent theme is updated, any files you edited directly get overwritten. A child theme avoids this.
Start by creating a folder and a style.css file that declares the parent theme:
/*
Theme Name: My Twenty Ten Child
Theme URI: http://www.opensourceisbetter.com/
Description: Child theme for the Twenty Ten theme
Author: Andrea
Template: twentyten
*/
The Template line must match the folder name of the parent theme exactly. Activate the child theme from Appearance > Themes.
For the styles to work, create a functions.php file to enqueue the parent styles:
function my_theme_enqueue_styles() {
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
Now you can edit the child theme files freely. Add custom CSS to style.css, override template files by copying them from the parent theme, and add functionality through functions.php — all without touching the parent theme.
That is it!