Optimal approach for replacing the 8 header images in a child theme?

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.

Leave a Comment