Make WordPress Core

Opened 14 years ago

Closed 11 years ago

Last modified 11 years ago

#17236 closed feature request (maybelater)

Make it easier to subclass custom header and background

Reported by: otto42's profile Otto42 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Customize Keywords:
Focuses: Cc:

Description

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 (3)

#1 @cgrymala
12 years ago

  • Cc curtiss@… added

#2 @nacin
11 years ago

  • Component changed from Themes to Appearance

#3 @ocean90
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Since we now have the Customizer and #25569/#25571 this will not happen in near future. So probably wontfix, but for now maybelater seems fine.

Last edited 11 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.