Skip to content

Commit bc582fc

Browse files
committed
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
1 parent 112f9e9 commit bc582fc

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

src/wp-admin/css/customize-controls.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ body {
132132
}
133133

134134
#customize-theme-controls .control-section:last-of-type.open,
135-
#customize-theme-controls .control-section:last-of-type .accordion-section-title {
135+
#customize-theme-controls .control-section:last-of-type > .accordion-section-title {
136136
border-bottom-color: #ddd;
137137
}
138138

src/wp-admin/customize.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,8 @@
161161

162162
<div id="customize-theme-controls"><ul>
163163
<?php
164-
foreach ( $wp_customize->panels() as $panel ) {
165-
$panel->maybe_render();
166-
}
167-
foreach ( $wp_customize->sections() as $section ) {
168-
$section->maybe_render();
164+
foreach ( $wp_customize->containers() as $container ) {
165+
$container->maybe_render();
169166
}
170167
?>
171168
</ul></div>

src/wp-includes/class-wp-customize-manager.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ final class WP_Customize_Manager {
4343
*/
4444
public $widgets;
4545

46-
protected $settings = array();
47-
protected $panels = array();
48-
protected $sections = array();
49-
protected $controls = array();
46+
protected $settings = array();
47+
protected $containers = array();
48+
protected $panels = array();
49+
protected $sections = array();
50+
protected $controls = array();
5051

5152
protected $nonce_tick;
5253

@@ -305,6 +306,17 @@ public function controls() {
305306
return $this->controls;
306307
}
307308

309+
/**
310+
* Get the registered containers.
311+
*
312+
* @since 4.0.0
313+
*
314+
* @return array
315+
*/
316+
public function containers() {
317+
return $this->containers;
318+
}
319+
308320
/**
309321
* Get the registered sections.
310322
*
@@ -891,6 +903,10 @@ public function prepare_controls() {
891903
$panels[] = $panel;
892904
}
893905
$this->panels = $panels;
906+
907+
// Sort panels and top-level sections together.
908+
$this->containers = array_merge( $this->panels, $this->sections );
909+
uasort( $this->containers, array( $this, '_cmp_priority' ) );
894910
}
895911

896912
/**

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,9 @@ public function customize_register() {
434434
}
435435

436436
$this->manager->add_panel( 'widgets', array(
437-
'title' => __( 'Widgets' ),
437+
'title' => __( 'Widgets' ),
438438
'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ),
439+
'priority' => 110,
439440
) );
440441

441442
foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {

0 commit comments

Comments
 (0)