When creating a new WordPress site, one of the most important steps is to use parent and child themes. Child theme support has been greatly improved with WordPress 3.0 and it’s highly recommended when customizing a theme for your site.
A child theme inherits the functionality of a parent theme and it keeps all of your customizations in their own folder. In this case when you update your theme to newer versions without overwriting your customizations, all of the customizations you’ve made will be preserved within the child theme.
Creating a Child Theme:
- Make a new directory in wp-content/themes, and name it twentyeleven-child (or anything you like).
- This directory can contain as little as a style.css file with child theme details and indication of the main theme it will inherit from (required), and as much as any full-fledged WordPress theme files (optional)
- Edit the CSS with the following info:
/* Theme Name: Child Theme twentyeleven (required) Theme URI: http: //example.com/ (optional) Description: Child theme for the Twenty Eleven theme (optional) Author: Your name here (optional) Author URI: http: //example.com/about/ (optional) Template: twentyeleven (required) Version: 0.1.0 (optional)
@importrule. If you put other rules above it, it will be invalidated and the stylesheet of the parent will not be imported.
Using functions.php in wordpress child theme
Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.) In that way, the functions.php of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme.
More detailed tutorial on How To Create a child theme (WordPress)