Building Child Themes

What Are Child Themes

Why Use Child Themes

Examples

Twenty Ten

get_template_part

Override or Remove

Child Theme's functions.php file loaded first

If removing an action or filter, wrap it in a function and hook it earlier

function twentyten_excerpt_length( $length ) {
	return 40;
}
add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
			
function jorbin_remove_excerpt_length(){
	remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
}
add_action( 'init', 'jorbin_remove_excerpt_length' );
			

Override a function

if ( ! function_exists( 'twentyten_setup' ) ):
function twentyten_setup() {
		

This means you can define your own twentyten_setup function, and the twentyten_setup function in twenty ten is never run.

Thirty Ten Style


/*
Theme Name: Thirty Ten
Theme URI: http://aaron.jorb.in/thirty-ten
Description: A child theme of 2010.
Author: Aaron Jorbin based on work by the WordPress team
Author URI: http://aaron.jorb.in/
Version: 1.1
Template: twentyten
*/

@import url('../twentyten/style.css');
		

Same as a regular theme, except we define a Template (which is the Parent's Directory) and then import the parents style sheet

Move the Menu, Change the Link Colors

/* Move menu to be above image */
#header #access{
top: -240px;
position: relative;
}
#site-title {margin:0 0 44px;}
/* Change our default link colors */
a:link{color:#fdb120;}
a:visited{color:#d00c0d;}
a:hover{color:#1143d8;}
a:active{color:#a67942;}
			

Thematic

Turns theme development into plugin development

You can hook into:

Helpful Hints

Go BlackHawks!