Tidy up left sidebar check

Removed all the unnecessary code to explicitly set the primary column's width. This is handled by Bootstrap 4's auto-layout. If we just provide it a column and its breakpoint, then as long as the sidebars have an explicit column width, the main will auto-fill.
This commit is contained in:
gillespieza 2018-10-15 15:48:12 +02:00 committed by GitHub
parent 94fb26825f
commit ece6f9373f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 24 deletions

View File

@ -18,26 +18,4 @@ $sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
<?php get_template_part( 'sidebar-templates/sidebar', 'left' ); ?> <?php get_template_part( 'sidebar-templates/sidebar', 'left' ); ?>
<?php endif; ?> <?php endif; ?>
<?php <div class="col-md content-area" id="primary">
$html = '';
if ( 'right' === $sidebar_pos || 'left' === $sidebar_pos ) {
$html = '<div class="';
if ( ( is_active_sidebar( 'right-sidebar' ) && 'right' === $sidebar_pos ) || ( is_active_sidebar( 'left-sidebar' ) && 'left' === $sidebar_pos ) ) {
$html .= 'col-md-8 content-area" id="primary">';
} else {
$html .= 'col-md-12 content-area" id="primary">';
}
echo $html; // WPCS: XSS OK.
} elseif ( 'both' === $sidebar_pos ) {
$html = '<div class="';
if ( is_active_sidebar( 'right-sidebar' ) && is_active_sidebar( 'left-sidebar' ) ) {
$html .= 'col-md-6 content-area" id="primary">';
} elseif ( is_active_sidebar( 'right-sidebar' ) || is_active_sidebar( 'left-sidebar' ) ) {
$html .= 'col-md-8 content-area" id="primary">';
} else {
$html .= 'col-md-12 content-area" id="primary">';
}
echo $html; // WPCS: XSS OK.
} else {
echo '<div class="col-md-12 content-area" id="primary">';
}