Categories Tutorials

A bugfix for WordPress 3: Building Child Themes on

With the update of WordPress to version 3.4 came some important feature improvements that changed the way certain key components work. This includes how the header image and background functionality is implemented. This in turn means the old methods of making changes to these elements suddenly don’t work any more.

The Issue

This change has made a previously well functioning component in my WordPress 3: Building Child Themes course on non-functional.

In movie 2.3 I instruct the viewer to redefine the height and width of the header image using the following code in a child theme functions.php file:

define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 980 ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 224 ) );

Unfortunately with the new implementation of the header image function, this no longer works. A new filter function is needed.

The Fix

To get the result you want without messing things up in the process, a modified version of the code above is necessary. So, to resize the header image in a child theme of Twenty Ten you use the following code:

function tnc_header_width($width) {
	$width = 980;
	return $width;

function tnc_header_height($height) {
	$height = 224;
	return $height;

add_filter( 'twentyten_header_image_width', 'tnc_header_width' );
add_filter( 'twentyten_header_image_height', 'tnc_header_height' );


An Update is Imminent

We are hard at work rolling out an update to the course to bring it in line with the new version of Twenty Ten. Until then, just use the code above and everything will work fine.