WordPress.org

Make WordPress Core

Ticket #27401: 27401.diff

File 27401.diff, 1.2 KB (added by westonruter, 7 years ago)

Order widget area sections in the order they were registered. Give widget area sections a high priority so that they appear at the end of the customizer. https://github.com/x-team/wordpress-develop/compare/trac-27401

  • src/wp-includes/class-wp-customize-widgets.php

    diff --git src/wp-includes/class-wp-customize-widgets.php src/wp-includes/class-wp-customize-widgets.php
    index 2182ca1..249505b 100644
    class WP_Customize_Widgets { 
    258258         * @action customize_register
    259259         */
    260260        static function customize_register( $wp_customize = null ) {
    261                 global $wp_registered_widgets, $wp_registered_widget_controls;
     261                global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars;
    262262                if ( ! ( $wp_customize instanceof WP_Customize_Manager ) ) {
    263263                        $wp_customize = $GLOBALS['wp_customize'];
    264264                }
    class WP_Customize_Widgets { 
    311311                                        $section_args = array(
    312312                                                'title' => sprintf( __( 'Widgets: %s' ), $GLOBALS['wp_registered_sidebars'][$sidebar_id]['name'] ),
    313313                                                'description' => $GLOBALS['wp_registered_sidebars'][$sidebar_id]['description'],
     314                                                'priority' => 1000 + array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
    314315                                        );
    315316                                        $section_args = apply_filters( 'customizer_widgets_section_args', $section_args, $section_id, $sidebar_id );
    316317                                        $wp_customize->add_section( $section_id, $section_args );