How to replace default rotating header images with my own

Best way to go is to make a Child Theme of Twenty Eleven.

Then first remove the default images:

    // REMOVE TWENTY ELEVEN DEFAULT HEADER IMAGES
function wptips_remove_header_images() {
    unregister_default_headers( array('wheel','shore','trolley','pine-cone','chessboard','lanterns','willow','hanoi')
    );
}
add_action( 'after_setup_theme', 'wptips_remove_header_images', 11 );

After that you can tell your Child theme to use your own images:

    //ADD NEW DEFAULT HEADER IMAGES
function wptips_new_default_header_images() {
    $child2011_dir = get_bloginfo('stylesheet_directory');
    register_default_headers( array (
        'image1' => array (
            'url' => "$child2011_dir/images/image1.jpg",
            'thumbnail_url' => "$child2011_dir/images/image1-thumb.jpg", // 230 x 66px
            'description' => __( 'Image Description', 'child2011' )
        ), // if you have more than one image you will need a comma between all of them, except for the last one
        'image2' => array (
            'url' => "$child2011_dir/images/image2.jpg",
            'thumbnail_url' => "$child2011_dir/images/image2-thumb.jpg", // 230 x 66px
            'description' => __( 'Image Description', 'child2011' )
        ) // the last image does not get a comma
    ));
}
add_action( 'after_setup_theme', 'wptips_new_default_header_images' );

You can read the entire explanation on http://wpti.ps/?p=107

Leave a Comment