Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#34549 closed defect (bug) (fixed)

Theme Customizer: Disable "Change [theme]" button when only one theme available

Reported by: danielbachhuber's profile danielbachhuber Owned by: westonruter's profile westonruter
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.2
Component: Customize Keywords: has-patch commit
Focuses: Cc:

Description

As a user, when I'm in the Customizer and only have one theme available to activate, it's confusing to see a "Change" button in this context:

https://dl.dropboxusercontent.com/s/ta8cu3qi2e8ayqj/2015-11-01%20at%202.45%20PM%202x.png

Attachments (4)

34549.diff (1.2 KB) - added by westonruter 8 years ago.
34549.2.diff (965 bytes) - added by danielbachhuber 8 years ago.
34549.3.diff (2.2 KB) - added by westonruter 8 years ago.
34549.4.diff (853 bytes) - added by westonruter 8 years ago.

Download all attachments as: .zip

Change History (12)

@westonruter
8 years ago

#1 @westonruter
8 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Awaiting Review to 4.4
  • Owner set to westonruter
  • Status changed from new to accepted
  • Version set to 4.2

@danielbachhuber Good call. Please test 34549.diff.

The alternative would be to just not add the themes section or theme controls at all.

#2 @danielbachhuber
8 years ago

My initial thought would be to just hide the "Change" button: 34549.2.diff

However, I'm not opposed to hiding the theme section entirely. It's a little bit inconsistent if you've gone from multiple themes to one, but I think that's edge case behavior.

#3 @westonruter
8 years ago

If I only have one theme, I already know what what it is and I don't need to be told. It just kinda wastes space.

Note in 34549.2.diff if that approach is taken, we should avoid calling wp_prepare_themes_for_js() a second time in there because if there are a lot of themes (e.g. on WordPress.com) this can be very slow.

@westonruter
8 years ago

#4 @westonruter
8 years ago

  • Keywords commit added

34549.3.diff follows down @danielbachhuber's approach in 34549.2.diff, but improves efficiency by setting a new $theme_count property on WP_Customize_Themes_Section.

@westonruter
8 years ago

#5 @westonruter
8 years ago

Actually, silly me, we can just use count( $this->controls ) to determine how many themes are added. See 34549.4.diff.

In a future release we can decided whether the themes section itself should be hidden entirely if there is only one available theme.

#6 @westonruter
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 35535:

Customize: Hide "Change" button in themes section if there are fewer than two available themes.

Props danielbachhuber, westonruter.
Fixes #34549.

#7 @westonruter
7 years ago

In 35943:

Customize: Ensure that "Change" button appears when there are only 2 themes.

Fixes defect introduced in [35535].

Props igmoweb.
See #34549.
Fixes #35081.

#8 @dd32
7 years ago

In 36065:

Customize: Ensure that "Change" button appears when there are only 2 themes.

Fixes defect introduced in [35535].

Merges [35943] to the 4.4 branch.
Props igmoweb.
See #34549.
Fixes #35081.

Note: See TracTickets for help on using tickets.