Make WordPress Core

Opened 3 years ago

Last modified 2 months ago

#17236 new feature request

Make it easier to subclass custom header and background

Reported by: Otto42 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Appearance Keywords:
Focuses: Cc:


The functions that add the custom header and background contain code like this:

require_once( ABSPATH . 'wp-admin/custom-header.php' );
$custom_image_header = new Custom_Image_Header( $admin_header_callback, $admin_image_div_callback );
add_action( 'admin_menu', array( &$custom_image_header, 'init' ) );

This makes it difficult to extend those classes, since they're referenced here directly. Replacing them with subclasses involves not only modifying the global after the fact, but removing and re-adding the action hook to the newly created sub-class item.

The fact that this base class is only included at this point also makes it difficult to load your own subclass at the right time, since you have to add the custom image header first, then load, then remove the action hook, then replace the class, then do the action hook yourself...

It would be nice if it was possible to more easily replace these globals (both header and background) with a different class at the time of definition here. I'm not sure of the best way to do this. Perhaps with a hook allowing the user to replace the class before the add_action? Or by having the new itself use a class of the users own defining.

Change History (2)

comment:1 cgrymala21 months ago

  • Cc curtiss@… added

comment:2 nacin2 months ago

  • Component changed from Themes to Appearance
Note: See TracTickets for help on using tickets.