[wp-trac] [WordPress Trac] #27177: Child themes should inherit parent theme customizer settings on activation / switching

WordPress Trac noreply at wordpress.org
Wed Jun 11 18:40:32 UTC 2014


#27177: Child themes should inherit parent theme customizer settings on activation
/ switching
-------------------------+------------------------------
 Reporter:  krogsgard    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Appearance   |     Version:  3.8
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  administration
-------------------------+------------------------------

Comment (by tollmanz):

 We have run into this issue repeatedly at The Theme Foundry. We had a
 number of users who use a workflow like this:

 1. Install parent theme
 1. Customize theme via the customizer
 1. Run into style issue that cannot be handled via a theme option
 1. Install child theme to add custom CSS
 1. Add options are lost

 We tend to store our theme options in theme mods as it is a little easier
 to manage everything within a single option and using a simpler API.

 We have already dealt with this situation with loading templates. If you
 want to support child theme templates overriding parent theme templates,
 use {{{get_template_part()}}}, otherwise use {{{locate_template}}} or
 {{{include/require}}}. A similar approach might work well here. We could
 have a function, say {{{get_theme_mod_wherever_it_is}}} (ignore the actual
 name for now), that looks up the child theme mod, uses it if found,
 otherwise falls back to the parent theme mod. Then, we could then have
 {{{get_theme_mod_parent}}}, which only ever gets a theme mod from a parent
 theme. Finally, {{{get_theme_mod}}} can continue to just get the option
 from the current theme's theme mod.

 I think there is great value in standardizing this approach. We went to
 reinvent the wheel every time this problem comes up, which leads to
 inconsistency across our themes. Codifying an API to better handle this
 scenario would improve consistency for all themes.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27177#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list