Created
October 5, 2015 08:22
-
-
Save benjaminpick/d7d86238706b7554b4c2 to your computer and use it in GitHub Desktop.
Preferential Lite Fix for left sidebar (drop this file in your child theme)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying all pages. | |
* | |
* This is the template that displays all pages by default. | |
* Please note that this is the WordPress construct of pages | |
* and that other 'pages' on your WordPress site will use a | |
* different template. | |
* | |
* @package Preferential | |
*/ | |
$nbSidebars = is_active_sidebar( 'pageleft' ) + is_active_sidebar( 'pageright' ); | |
$col_middle = 'col-md-' . (12 - 3*$nbSidebars); | |
get_header(); ?> | |
<div id="pref-main-section"> | |
<div role="main"> | |
<?php get_sidebar( 'top' ); ?> | |
<div class="container"> | |
<div class="row"> | |
<?php if (is_active_sidebar( 'pageleft' )): ?> | |
<div class="col-md-3"> | |
<?php get_sidebar( 'left' ); ?> | |
</div> | |
<?php endif; ?> | |
<div class="<?php echo $col_middle; ?>"> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php get_template_part( 'content', 'page' ); ?> | |
<?php | |
// If comments are open or we have at least one comment, load up the comment template | |
if ( comments_open() || '0' != get_comments_number() ) : | |
comments_template(); | |
endif; | |
?> | |
<?php endwhile; // end of the loop. ?> | |
</div> | |
<?php if (is_active_sidebar( 'pageright' )): ?> | |
<div class="col-md-3"> | |
<?php get_sidebar( 'right' ); ?> | |
</div> | |
<?php endif; ?> | |
</div> | |
</div> | |
<?php get_sidebar( 'bottombanner' ); ?> | |
</div> | |
</div> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment