Child themes make customizing your theme even easier. Being able to add custom css through the admin panel is great, but what it you need to change more? If you’ve ever edited php files, then you know how hard it can be to upgrade your theme later. Many times, you forgot what you edited and what needs to changed in the new theme. This can lead to lots of frustration and maybe a broken site.
Child themes solve these problems. A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme. By activating a child theme, you ensure that changes you make to the template files are not overwritten when upgrading the main theme. It’s pure genius!
Using Child Themes
Here’s a simple plugin to create your own child theme. Any template files that you wish to edit should be copied to your child theme folder. Whatever changes you make will overwrite the files of the parent theme.
Layout Customization Hooks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<li>bc_header// Opening header tag and logo/header text</li>
<li>bc_header_extras// Additional content may be added to the header</li>
<li>bc_above_navbar// Opening navigation wrapper</li>
<li>bc_below_navbar// Closing navigation wrapper</li>
<li>bc_navbar// Opening navigation element and WP3 menus</li>
<li>bc_above_slideshow// Opening slideshow wrapper</li>
<li>bc_below_slideshow// Closing slideshow wrapper</li>
<li>bc_slideshow// Homepage slideshow</li>
<li>bc_before_content// Opening content wrapper</li>
<li>bc_after_content// Closing content wrapper</li>
<li>bc_before_sidebar// Opening sidebar wrapper</li>
<li>bc_after_sidebar// Closing sidebar wrapper</li>
<li>bc_before_footer// Opening footer wrapper</li>
<li>bc_footer// The footer (includes sidebar-footer.php)</li>
<li>bc_after_footer// The closing footer wrapper</li>
|
When using a child theme, you can override certain functions (those wrapped in a
|
function_exists()
|
call) by defining them first in your child theme’s functions.php file. The child theme’s functions.php file is included before the parent theme’s file, so the child theme functions would be used.
Functions that are not pluggable (not wrapped in function_exists()) are instead attached to a filter or action hook. The hook can be removed by using remove_action() or remove_filter() and you can attach your own function to the hook.
see http://codex.wordpress.org/Theme_Development and http://codex.wordpress.org/Child_Themes