Customizing WordPress themes without losing changes on updates

The layout and appearance of a WordPress blog is determined by its theme. Most themes offer various options to customize its looks, but often some additional coding is required to create your desired design. If the theme files are modified directly, all modifications will be gone when the theme is updated. A more durable solution is desirable.
1 answer

The best way to customize a WordPress theme, is to create a child theme. To do this, you need to create a directory in the themes folder, add a style.css and set the the ‘Template’ parameter in its header to the name of the parent theme:

/*
Theme Name: Some Child Theme
Template: some-parent-theme
*/

Then you need to create a functions.php file and make sure to enqueue the parents css:

add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_styles' );
function mytheme_enqueue_styles() {
   wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

After that, you can copy any template file from the parent theme to your child themes directory and change whatever you need. These files won’t be overwritten when the parent theme receives an update.