#34549 closed defect (bug) (fixed)
Theme Customizer: Disable "Change [theme]" button when only one theme available
| Reported by: | danielbachhuber | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | Customize | Version: | 4.2 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
Attachments (4)
Change History (12)
#1
@
11 years ago
- Keywords has-patch added; needs-patch removed
- Milestone Awaiting Review → 4.4
- Owner set to
- Status new → accepted
- Version → 4.2
#2
@
11 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
@
11 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.
#4
@
11 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.
#5
@
11 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)

@danielbachhuber Good call. Please test 34549.diff.
The alternative would be to just not add the themes section or theme controls at all.