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 matter 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
See TwentyEleven to get the idea: it uses
register_default_headers()
to add new header images. In your plugin or theme just add:The
%s
will be replaced by the stylesheet directory URI. You don’t have to use that. You can useplugin_dir_url( __FILE__ )
instead of%s
.You can call
register_default_headers()
multiple times, it works just like aadd_default_headers()
.Update
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.
This has already been answered here before:
If you look at the Twenty Eleven theme and other default themes you can use the featured image as a custom header image if its exactly the same width as the default header.