WordPress themes are great and very versatile. However there are times when the themes are just not enough and you want to put your own style on it. To do this the right way, don’t edit the theme’s style.css files, but create a child theme w/ a css file that imports styling from the parent theme.
In this example, I’ll show you how to create a Child theme from the Twenty Twelve WordPress theme.
First thing you need to do is create a directory/new folder where your themes are located. Usually, it will be in your WordPress’s blog directory/wp-content/themes… Name your folder with a “-child” suffix; as you can see, I named mine twentytwelve-child.
Next, create a css file named “style.css” and save it into the child theme folder. You can copy and paste the code below and save as “style.css” if you like:
/* Theme Name: Twenty Twelve Child Theme URI: http://example.com/twenty-fourteen-child/ Description: Twenty Twelve Child Theme Author: Author Name Author URI: http://example.com Template: twentytwelve Version: 1.0.0 Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready Text Domain: twenty-twelve-child */ @import url("../twentytwelve/style.css"); /* =Theme customization starts here -------------------------------------------------------------- */
The important aspects to note are “Theme Name”, “Template”, and “@import” section. Theme Name describes your theme; Template defines the parent theme template, and @import line imports the script from the parent’s style.css file.
Now upload this file into the child theme directory you created earlier.
You can find and edit the Child’s theme style.css file in your WordPress admin, under “Appearance >> Editor”
Any code you input after the “theme customization starts here —- */” line should override your Parent Theme’s style. This is good practice since theme’s constantly gets updated and this protects all your style overrides from reverting back to the theme’s default.
For official codex, please visit http://codex.wordpress.org/Child_Themes