Opened 17 years ago
Closed 17 years ago
#9152 closed defect (bug) (fixed)
Custom header from theme A used when previewing theme B
| Reported by: | Viper007Bond | Owned by: | westi |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | Themes | Version: | 2.7 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: | Focuses: |
Description
As reported by Matt.
If you're using theme A and set a custom header via the standardized API (i.e. a background image and text color) and then preview theme B on the theme switcher, the settings from theme A are used. Once you actually switch themes though, it works fine and uses the settings from theme B.
The problem stems from get_current_theme() returning theme A even when previewing theme B.
function get_theme_mod($name, $default = false) { $theme = get_current_theme(); $mods = get_option("mods_$theme"); if ( isset($mods[$name]) ) return apply_filters( "theme_mod_$name", $mods[$name] ); return apply_filters( "theme_mod_$name", sprintf($default, get_template_directory_uri(), get_stylesheet_directory_uri()) ); }
Still working on a solution to this (i.e. telling WordPress it's using theme B during the preview or something).
Attachments (3)
Change History (12)
@
17 years ago
Previous patch wasn't properly returning mod options for theme being previewed, now it does
#6
@
17 years ago
I used the "ambiru" and "benevolence" themes from the WordPress.com theme SVN for testing purposes.
#7
@
17 years ago
Just did a quick test of this - not enough time to investigate further but it looked like the preview was still showing the image text colour from the active theme.
#8
@
17 years ago
Ooooh, I think I just realized what the problem is. The theme you're previewing doesn't have a custom header, does it?
If not, that means get_option('mod_PreviewTheme') returns false. That makes the filter not kick into effect and abort the get_option('mod_CurrentTheme').
Looks like rather than showing the previewed theme's custom header when previewing it, we'll have to display just the default version of the theme at all themes.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This patch seems to do the trick. It hacks the theme header mods option to return the mod settings for the theme being displayed rather than the actual current theme.