Recently we added some API to WordPress 2.1 to make adding custom image headers to themes much easier. We use this API for the themes on wordpress.com. The API is pretty simple. First, define some defaults:
define('HEADER_TEXTCOLOR', '009193'); define('HEADER_IMAGE', '%s/images/spring_flavour/header_bg.jpg'); // %s is theme dir uri define('HEADER_IMAGE_WIDTH', 690); define('HEADER_IMAGE_HEIGHT', 115);
Next you need to define a couple of functions. One styles the blog header and the other styles the admin header. See the functions header_style() and admin_header_style() defined in this sample theme functions.php.
Those functions can now be registered as callbacks with the add_custom_image_header() function.
add_custom_image_header() does the work of creating a “Custom Image Header” page in the “Presentation” menu. The “Custom Image Header” page handles allowing users to change the header text color and upload and crop new header images.
Define a few constants and a couple of functions and your theme can easily add custom image header support. Here are some more sample functions.php files from various themes that use the custom image header API.