From bc582fc058a670a45dbdae3fdfd98d7aed2385d3 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 14 Aug 2014 04:42:30 +0000 Subject: [PATCH] Customizer: Mixed priority sorting for panels and top-level sections. props celloexpressions. fixes #28979. git-svn-id: https://develop.svn.wordpress.org/trunk@29488 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/customize-controls.css | 2 +- src/wp-admin/customize.php | 7 ++---- .../class-wp-customize-manager.php | 24 +++++++++++++++---- .../class-wp-customize-widgets.php | 3 ++- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css index 8dacce89cb..86e5fb5ff6 100644 --- a/src/wp-admin/css/customize-controls.css +++ b/src/wp-admin/css/customize-controls.css @@ -132,7 +132,7 @@ body { } #customize-theme-controls .control-section:last-of-type.open, -#customize-theme-controls .control-section:last-of-type .accordion-section-title { +#customize-theme-controls .control-section:last-of-type > .accordion-section-title { border-bottom-color: #ddd; } diff --git a/src/wp-admin/customize.php b/src/wp-admin/customize.php index b5524b00e7..de43197695 100644 --- a/src/wp-admin/customize.php +++ b/src/wp-admin/customize.php @@ -161,11 +161,8 @@ do_action( 'customize_controls_print_scripts' );
diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 6a04ea7a12..4465a80545 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -43,10 +43,11 @@ final class WP_Customize_Manager { */ public $widgets; - protected $settings = array(); - protected $panels = array(); - protected $sections = array(); - protected $controls = array(); + protected $settings = array(); + protected $containers = array(); + protected $panels = array(); + protected $sections = array(); + protected $controls = array(); protected $nonce_tick; @@ -305,6 +306,17 @@ final class WP_Customize_Manager { return $this->controls; } + /** + * Get the registered containers. + * + * @since 4.0.0 + * + * @return array + */ + public function containers() { + return $this->containers; + } + /** * Get the registered sections. * @@ -891,6 +903,10 @@ final class WP_Customize_Manager { $panels[] = $panel; } $this->panels = $panels; + + // Sort panels and top-level sections together. + $this->containers = array_merge( $this->panels, $this->sections ); + uasort( $this->containers, array( $this, '_cmp_priority' ) ); } /** diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php index 3634dabbf0..4413ee6b9d 100644 --- a/src/wp-includes/class-wp-customize-widgets.php +++ b/src/wp-includes/class-wp-customize-widgets.php @@ -434,8 +434,9 @@ final class WP_Customize_Widgets { } $this->manager->add_panel( 'widgets', array( - 'title' => __( 'Widgets' ), + 'title' => __( 'Widgets' ), 'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ), + 'priority' => 110, ) ); foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {