WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#37619 new feature request

Feature to Insert Child Property In Parent Theme Customizer

Reported by: footballnasha Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.3
Component: Customize Keywords: reporter-feedback close
Focuses: Cc:
PR Number:

Description

Please Allow possiblity to insert extra properties from child theme to parent theme existing customizer options.
For Ex:

Suppose there is Color Section Created in parent theme
If I want to add extra color options from child theme to same Existing Color section Of parent theme its Not possible at the moment.

Change History (4)

#1 @footballnasha
3 years ago

  • Severity changed from normal to major

#2 @swissspidy
3 years ago

  • Focuses ui accessibility administration template removed
  • Severity changed from major to normal

#3 @westonruter
3 years ago

  • Keywords reporter-feedback added

@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
# parent-theme/functions.php
// ...
add_action( 'customize_register', 'parent_theme_customize_register', 10 );
<?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.

#4 @celloexpressions
3 years ago

  • Keywords close added
Note: See TracTickets for help on using tickets.