A child theme is a theme that inherits from a parent theme
You should ALWAYS ALWAYS use a child theme instead of editing a pre-existing theme.
There are only a few steps to make a child theme:
-
Create a directory in
my-blog/wp-contents/themes
name it whatever you want your custom child theme to be called. -
Create a
style.css
file in your newly created folder. -
Put this snippet at the top of your CSS file. Replace the
Template:
value in the comment block and the file path in the@import
statement with whatever theme you'd like to use as the "parent".
/*
Theme Name: Twenty Sixteen Child
Theme URI: http://example.com/twenty-sixteen-child/
Description: Twenty Sixteen Child Theme
Author: Tyler Buchea
Author URI: http://example.com
Template: twentysixteen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-sixteen-child
*/
@import url("../twentysixteen/style.css");
-
Select your newly created child theme in the WP admin panel under
Appearance > Theme
. -
Create a
functions.php
file in your child theme folder. Then add this line to it:
<?php
/*
No need for this now but it may come in
handy later for more advanced customization
*/
That's it
Now look at the file/folder structure of your parent. You just have to create an identical file in the same location in your child theme folder to override any parent file.
Resources
On the shoulders of giants