Make WordPress Core

Opened 20 months ago

Closed 18 months ago

Last modified 18 months ago

#26505 closed enhancement (duplicate)

Custom Header cropping code extraction

Reported by: ehg Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Customize Keywords:
Focuses: Cc:


@miguelcsf and I are working on implementing cropping for the Customizer's Header section (which will address #21785). We wanted to extract some common code we copied from wp-admin/custom-header.php's step_3() into a class that we can use in both our own code and Appearance -> Header.

I've attached a patch which contains this new class, the refactored custom-header.php and a few tests.

Feedback would be greatly appreciated!

Attachments (2)

custom-header-extraction.diff (14.0 KB) - added by ehg 20 months ago.
custom-header-extraction.2.diff (11.6 KB) - added by ehg 20 months ago.
don't create a new class, just add methods to custom-header.php

Download all attachments as: .zip

Change History (9)

comment:1 @nacin20 months ago

The Customizer already uses functionality from the custom header class, via $custom_image_header. A narrower refactor would probably be to just decorate the existing class with the public methods you need. This is also much easier to maintain. Over time, the custom header screen will ideally be replaced by the customizer (same goes for background), so the two classes powering those sites will just end up being more generic classes used by the Customizer, plus some fallback functionality for when it needs to render its own page.

comment:2 @ehg20 months ago

Thanks nacin - agreed. Submitting another patch!

@ehg20 months ago

don't create a new class, just add methods to custom-header.php

comment:3 @mcsf20 months ago

  • Cc mcsf added

comment:4 @ethitter20 months ago

  • Cc erick@… added

comment:5 @ehg20 months ago

  • Cc ehg added

comment:6 @ehg18 months ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #21785.

comment:7 @SergeyBiryukov18 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.