Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Has anyone seen a way to add a new header_image to a theme? I need to add two configurable images in a theme. It doesn't really mater if it gets added as a new "Header" admin theme menu or if it's added to the existing Apperance->Header menu.

I'm a bit new to plugin development so any help in the right direction is appreciated. I can't really find any hooks or actions to attach to.

Similar to this request

share|improve this question
add comment

1 Answer

See TwentyEleven to get the idea: it uses register_default_headers() to add new header images. In your plugin or theme just add:

add_action( 'after_setup_theme', 'wpse_42529_add_header_images' );

function wpse_42529_add_header_images()
            'a_short_name' => array(
            'url' => '%s/images/headers/a_short_name.jpg',
            'thumbnail_url' => '%s/images/headers/a_short_name-thumbnail.jpg',
            'description' => __( 'Wheel', 'twentyeleven' )
        'another_image' => array(
            'url' => '%s/images/headers/another_image.jpg',
            'thumbnail_url' => '%s/images/headers/another_image-thumbnail.jpg',
            'description' => __( 'Shore', 'twentyeleven' )

The %s will be replaced by the stylesheet directory URI. You don't have to use that. You can use plugin_dir_url( __FILE__ ) instead of %s.

You can call register_default_headers() multiple times, it works just like a add_default_headers().


To add a new page for custom images similar to the custom header you should extend the class Custom_Image_Header in a theme options page. But this very class is under reconstruction right now – it is almost impossible to write future proof code based on this. I would wait for WordPress 3.4 and build the code on a more stable base.
Well … I will do that, because I need it probably too.

Another way: copy and modify the current class instead of extending it.

share|improve this answer
I think you have misunderstood what I'm asking for. I'm not talking about different images, but two images containers. –  grm Feb 16 '12 at 12:26
@grm I added a note to explain why I would wait for WP 3.4. Sorry for misinterpreting your question. –  toscho Feb 17 '12 at 6:23
Do you need a thumbnail url? How would I go about making one? –  AlxVallejo Aug 9 '12 at 15:38
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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