#17832 closed defect (bug) (fixed)
Don't default to random header image rotation when HEADER_IMAGE = ''
| Reported by: | ryan | Owned by: | ryan |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Component: | Themes | Version: | 3.2 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
Description (last modified by )
Themes that define HEADER_IMAGE = '' as well as register multiple default images now default to random image rotation in 3.2. This can be very unexpected and produce poor results. A theme that supports header images but defaults to text only probably has good reason to do so. Showing images where before there were non can make text unreadable in themes that place text over the header image. Perhaps defaulting to random should be opt-in. Maybe an add_theme_support() call.
Attachments (2)
Change History (16)
#3
@
15 years ago
Messing with HEADER_IMAGE proved more painful that supporting add_theme_support(). Patch adds add_theme_support( 'custom-header', array( 'random' => true ) ).
#8
@
15 years ago
I like the idea of moving towards add_theme_support() instead of the definitions, but... I'd argue that the opt-in already exists: registering multiple header images.
I can't think of a reason (or an existing example in the wild) where a theme registers multiple header images but defaults to text only display. Did you find a case like that? Seems very much like an edge case.
See the original discussion and implementation in #17240. I'd originally intended to use HEADER_IMAGE value of "random" to trigger this, but it seemed like leaving it empty meant the same thing.
The argument Aaron Campbell made on the original ticket is that the user should choose whether to enable random or not, not the theme itself. The theme should always have the randomness available if multiple images exist.
To me that's the one thing I don't like about this feature, there isn't a way for a theme to enable randomness and turn it off by default and let the user choose. It's either on or off from the theme level.
It's also confusing what purpose define( 'HEADER_IMAGE', '' ); would serve now.
#9
@
15 years ago
OK, after testing this for a while I see how it works. And it works great!
The random option still exists in the UI regardless of the add_theme_support() call, which is what we want. If the random rotation is turned on by default with add_theme_support() the radio button for random default images is on, which is what we want for the UI.
Attached is a refreshed patch that adds better commenting to both theme.php and the Twenty Eleven functions file.
#10
follow-up:
↓ 11
@
15 years ago
We could call it random-default instead of random. Or use default = random with the notion of being able to handle other defaults this way later. Although I'd rather not open that up right now.
This came up when I added multiple headers to p2. It went from a default of no image to a default of random with no way to go back to a default of no image.
#11
in reply to: ↑ 10
@
15 years ago
Ryan, I like your implementation -- let's do it. See my updated patch for some small changes to comments to make things more clear.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
The simplest approach would have HEADER_IMAGE = '' continue meaning no default image ( including random ones). A theme that specifies an actual image in HEADER_IMAGE and registers multiple default images would get random turned on by default.