[wp-trac] [WordPress Trac] #37619: Feature to Insert Child Property In Parent Theme Customizer

WordPress Trac noreply at wordpress.org
Wed Aug 10 17:42:23 UTC 2016


#37619: Feature to Insert Child Property In Parent Theme Customizer
-------------------------------+------------------------------
 Reporter:  footballnasha      |       Owner:
     Type:  feature request    |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Customize          |     Version:  4.5.3
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by westonruter):

 * keywords:   => reporter-feedback


Comment:

 @footballnasha How is this not possible? In your child theme you'd just
 add new controls for the desired settings and add it to the same
 Customizer section that the parent them creates/uses. The issue you may be
 encountering is that the child theme's `customize_register` handler is
 firing '''before''' the parent theme's, since the child theme's
 `functions.php` is loaded before the parent theme's `functions.php`. So
 what you need to do is use the action priority to ensure that the child
 theme's code runs after. So for example:

 {{{#!php
 <?php
 # parent-theme/functions.php
 // ...
 add_action( 'customize_register', 'parent_theme_customize_register', 10 );
 }}}

 {{{#!php
 <?php
 # child-theme/functions.php
 // ...
 add_action( 'customize_register', 'child_theme_customize_register', 11 );
 }}}

 Note how the parent theme's `customize_register` hook has a priority lower
 than the child theme's hook, so this ensures the parent theme's hook will
 run first, and any section created in it will be ensured to exist when the
 child theme's hook runs.

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


More information about the wp-trac mailing list