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' );
panels() as $panel ) {
- $panel->maybe_render();
- }
- foreach ( $wp_customize->sections() as $section ) {
- $section->maybe_render();
+ foreach ( $wp_customize->containers() as $container ) {
+ $container->maybe_render();
}
?>
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 ) {