support for global layout and sidebar positioning

This commit is contained in:
Stef Kariotidis 2016-11-05 14:40:04 +02:00
parent 632a79a2b6
commit 2a5be194be
1 changed files with 20 additions and 4 deletions

View File

@ -13,13 +13,28 @@
get_header(); get_header();
?> ?>
<?php
$container = get_theme_mod('understrap_container_type');
$sidebar_pos = get_theme_mod('understrap_sidebar_position');
?>
<div class="wrapper" id="page-wrapper"> <div class="wrapper" id="page-wrapper">
<div class="container" id="content"> <div class="<?php echo $container?>" id="content">
<div class="row"> <div class="row">
<?php if ( 'left' === $sidebar_pos || 'both' === $sidebar_pos ): ?>
<?php get_sidebar( 'left' ); ?>
<?php endif; ?>
<?php if ( 'right' === $sidebar_pos || 'left' === $sidebar_pos ): ?>
<div class="<?php if ( is_active_sidebar( 'right-sidebar' ) || is_active_sidebar( 'left-sidebar' )) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<?php elseif ( is_active_sidebar( 'right-sidebar' ) && is_active_sidebar( 'left-sidebar' ) ): ?>
<div class="<?php if ( 'both' === $sidebar_pos ) : ?>col-md-6<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<?php endif; ?>
<div class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<main class="site-main" id="main" role="main"> <main class="site-main" id="main" role="main">
@ -39,8 +54,9 @@
</main><!-- #main --> </main><!-- #main -->
</div><!-- #primary --> </div><!-- #primary -->
<?php if ( 'right' === $sidebar_pos || 'both' === $sidebar_pos ): ?>
<?php get_sidebar(); ?> <?php get_sidebar( 'right' ); ?>
<?php endif; ?>
</div><!-- .row --> </div><!-- .row -->