Widget Customizer: Move widget area sections to bottom.

Since a theme can have a lot of widget areas and we don't want to bury third-party sections, bump the widget sections to the bottom with a priority of 1000+. Fixes also the ordering.

props westonruter.
fixes #27401.
Built from https://develop.svn.wordpress.org/trunk@27541


git-svn-id: http://core.svn.wordpress.org/trunk@27384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2014-03-14 20:01:14 +00:00
parent 574c2967b5
commit ca892563a6
1 changed files with 2 additions and 1 deletions

View File

@ -258,7 +258,7 @@ class WP_Customize_Widgets {
* @action customize_register * @action customize_register
*/ */
static function customize_register( $wp_customize = null ) { static function customize_register( $wp_customize = null ) {
global $wp_registered_widgets, $wp_registered_widget_controls; global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars;
if ( ! ( $wp_customize instanceof WP_Customize_Manager ) ) { if ( ! ( $wp_customize instanceof WP_Customize_Manager ) ) {
$wp_customize = $GLOBALS['wp_customize']; $wp_customize = $GLOBALS['wp_customize'];
} }
@ -311,6 +311,7 @@ class WP_Customize_Widgets {
$section_args = array( $section_args = array(
'title' => sprintf( __( 'Widgets: %s' ), $GLOBALS['wp_registered_sidebars'][$sidebar_id]['name'] ), 'title' => sprintf( __( 'Widgets: %s' ), $GLOBALS['wp_registered_sidebars'][$sidebar_id]['name'] ),
'description' => $GLOBALS['wp_registered_sidebars'][$sidebar_id]['description'], 'description' => $GLOBALS['wp_registered_sidebars'][$sidebar_id]['description'],
'priority' => 1000 + array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
); );
$section_args = apply_filters( 'customizer_widgets_section_args', $section_args, $section_id, $sidebar_id ); $section_args = apply_filters( 'customizer_widgets_section_args', $section_args, $section_id, $sidebar_id );
$wp_customize->add_section( $section_id, $section_args ); $wp_customize->add_section( $section_id, $section_args );