After creating a child theme which is made of style.css only (base on twentyeleven), the time has come to replace the images.

I found this great tip for accomplishing this by hacking the functions in twentyeleven but my main concern is minimizing work after a WordPress update.

I thought of simply replacing the images in /wp-content/themes/twentyeleven/images/headers (while keeping the original names as came with twentyeleven) but is this better?

It looks like either way I will have re-apply my customizations after updating WordPress in the future.

Is there a way to replace the 8 images, for a child theme, and still maintain the changes after an update?

1 Answer 1


I am never sure about 'optimal approach' - however, I am using this in the functions.php in a child theme of Twenty Eleven

//deregister the header images of Twenty Eleven, and register a few new RAW header images//
add_action( 'after_setup_theme', 'raw_theme_header_images', 11 ); 

function raw_theme_header_images() {
unregister_default_headers( array( 'wheel', 'shore', 'trolley', 'pine-cone', 'chessboard', 'lanterns', 'willow', 'hanoi' ) ); 
$folder = get_stylesheet_directory_uri();
register_default_headers( array(
    'coleslaw' => array(
        'url' => $folder.'/images/headers/coleslaw.jpg',
        'thumbnail_url' => $folder.'/images/headers/coleslaw-thumb.jpg',
        /* translators: header image description */
        'description' => __( 'Coleslaw', 'twentyeleven' )
    'tomato_and_sprouts' => array(
        'url' => $folder.'/images/headers/tomato_and_sprouts.jpg',
        'thumbnail_url' => $folder.'/images/headers/tomato_and_sprouts-thumb.jpg',
        /* translators: header image description */
        'description' => __( 'Tomato and Sprouts', 'twentyeleven' )

the new images are in an /images folder in the child theme.

  • +1. Using unregister_default_headers() is absolutely the correct approach. Feb 1, 2012 at 16:44
  • @Michael Thanks +1. This looks similar to the solution in the link. Do I understand correctly from your answer that this solution doesn't modify any php file in the original twentyeleven and the above goes is only new code that goes into the child's directory?
    – ef2011
    Feb 1, 2012 at 17:17
  • correct - this all happens in the child theme's functions.php.
    – Michael
    Feb 1, 2012 at 18:17
  • I'm worried about possible future additions to the images with an upgrade => the list of files are hardcoded so still 'vulnerable' in case of an update. Another options might be to empty $_wp_default_headers. You could opt for mapping that array with the unregister_default_headers function for future extra code in that function. Any thoughts on that?
    – Nanne
    Mar 11, 2012 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.