Widgets: split the sidebars in two containers so there are no empty spaces when they are shown in two columns and some are open, other closed. See #25952.
Built from https://develop.svn.wordpress.org/trunk@26285 git-svn-id: http://core.svn.wordpress.org/trunk@26190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2b0a5aedc9
commit
30b1c76a01
|
@ -10810,33 +10810,33 @@ li#wp-admin-bar-toggle-button {
|
|||
#menu-locations-wrap .widefat {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 1250px) {
|
||||
#widgets-left #available-widgets .widget {
|
||||
width: 49%;
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
#widgets-right #available-widgets .widget:nth-child(even) {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#widgets-right .widgets-holder-wrap {
|
||||
width: 48.5%;
|
||||
#widgets-right .sidebars-column-1,
|
||||
#widgets-right .sidebars-column-2 {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#widgets-left .widgets-holder-wrap:nth-child(odd) {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#widgets-left .widgets-holder-wrap:nth-child(even) {
|
||||
float: left;
|
||||
width: 49%;
|
||||
}
|
||||
|
||||
#widgets-right.single-sidebar .widgets-holder-wrap {
|
||||
#widgets-right .sidebars-column-1 {
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
#widgets-right.single-sidebar .sidebars-column-1,
|
||||
#widgets-right.single-sidebar .sidebars-column-2 {
|
||||
float: none;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10810,33 +10810,33 @@ li#wp-admin-bar-toggle-button {
|
|||
#menu-locations-wrap .widefat {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 1250px) {
|
||||
#widgets-left #available-widgets .widget {
|
||||
width: 49%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
#widgets-left #available-widgets .widget:nth-child(even) {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#widgets-right .widgets-holder-wrap {
|
||||
width: 48.5%;
|
||||
#widgets-right .sidebars-column-1,
|
||||
#widgets-right .sidebars-column-2 {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#widgets-right .widgets-holder-wrap:nth-child(odd) {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#widgets-right .widgets-holder-wrap:nth-child(even) {
|
||||
float: right;
|
||||
width: 49%;
|
||||
}
|
||||
|
||||
#widgets-right.single-sidebar .widgets-holder-wrap {
|
||||
#widgets-right .sidebars-column-1 {
|
||||
margin-right: 2%;
|
||||
}
|
||||
|
||||
#widgets-right.single-sidebar .sidebars-column-1,
|
||||
#widgets-right.single-sidebar .sidebars-column-2 {
|
||||
float: none;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,13 +12,14 @@ wpWidgets = {
|
|||
sidebars = $('div.widgets-sortables'),
|
||||
isRTL = !! ( 'undefined' !== typeof isRtl && isRtl );
|
||||
|
||||
$('#widgets-right').children('.widgets-holder-wrap').children('.sidebar-name').click( function() {
|
||||
var $this = $(this), parent = $this.parent();
|
||||
if ( parent.hasClass('closed') ) {
|
||||
parent.removeClass('closed');
|
||||
$('#widgets-right .sidebar-name').click( function() {
|
||||
var $this = $(this), wrap = $this.closest('.widgets-holder-wrap');
|
||||
|
||||
if ( wrap.hasClass('closed') ) {
|
||||
wrap.removeClass('closed');
|
||||
$this.siblings('.widgets-sortables').sortable('refresh');
|
||||
} else {
|
||||
parent.addClass('closed');
|
||||
wrap.addClass('closed');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -345,27 +345,28 @@ do_action( 'widgets_admin_page' ); ?>
|
|||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
$theme_sidebars = array();
|
||||
foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
|
||||
if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) {
|
||||
$wrap_class = 'widgets-holder-wrap';
|
||||
if ( !empty( $registered_sidebar['class'] ) )
|
||||
$wrap_class .= ' ' . $registered_sidebar['class'];
|
||||
|
||||
?>
|
||||
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $wrap_class ); ?>">
|
||||
<div class="sidebar-name">
|
||||
<div class="sidebar-name-arrow"><br /></div>
|
||||
<h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
|
||||
<span class="spinner"></span>
|
||||
</h3>
|
||||
<h3><?php echo esc_html( $registered_sidebar['name'] ); ?> <span class="spinner"></span></h3>
|
||||
</div>
|
||||
<div class="widget-holder inactive">
|
||||
<?php wp_list_widget_controls( $registered_sidebar['id'] ); ?>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
} else {
|
||||
$theme_sidebars[$sidebar] = $registered_sidebar;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -375,29 +376,44 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
|
|||
|
||||
<div class="widget-liquid-right">
|
||||
<div id="widgets-right">
|
||||
<div class="sidebars-column-1">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
|
||||
if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) )
|
||||
continue;
|
||||
|
||||
$i = $split = 0;
|
||||
$sidebars_count = count( $theme_sidebars );
|
||||
|
||||
if ( $sidebars_count > 2 )
|
||||
$split = ceil( $sidebars_count / 2 );
|
||||
|
||||
foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) {
|
||||
$wrap_class = 'widgets-holder-wrap';
|
||||
if ( !empty( $registered_sidebar['class'] ) )
|
||||
$wrap_class .= ' sidebar-' . $registered_sidebar['class'];
|
||||
|
||||
if ( $i )
|
||||
$wrap_class .= ' closed'; ?>
|
||||
if ( $i > 0 )
|
||||
$wrap_class .= ' closed';
|
||||
|
||||
if ( $split && $i == $split ) {
|
||||
?>
|
||||
</div><div class="sidebars-column-2">
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $wrap_class ); ?>">
|
||||
<div class="sidebar-name">
|
||||
<div class="sidebar-name-arrow"><br /></div>
|
||||
<h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
|
||||
<span class="spinner"></span></h3></div>
|
||||
<?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
|
||||
<div class="sidebar-name">
|
||||
<div class="sidebar-name-arrow"><br /></div>
|
||||
<h3><?php echo esc_html( $registered_sidebar['name'] ); ?> <span class="spinner"></span></h3>
|
||||
</div>
|
||||
<?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
$i++;
|
||||
} ?>
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form action="" method="post">
|
||||
|
|
Loading…
Reference in New Issue