I'm writing a WP theme, and I want the main content area to change width based on whether there's an active sidebar or not. To make this easier, I'm using bootstrap.
The problem is that the output is blank.
Here's the code I'm trying to use to do the calculations:
<!-- Calculate content width based on sidebars -->
<?php
if ( is_active_sidebar( 'left_sidebar' ) && !is_active_sidebar( 'right_sidebar' ) ) {
$mainspan = "9";
}
?>
<?php
if ( !is_active_sidebar( 'left_sidebar' ) && is_active_sidebar( 'right_sidebar' ) ) {
$mainspan = "span9";
}
?>
<?php
if ( is_active_sidebar( 'left_sidebar' ) && is_active_sidebar( 'right_sidebar' ) ) {
$mainspan = "span6";
}
?>
<?php
if ( !is_active_sidebar( 'left_sidebar' ) && !is_active_sidebar( 'right_sidebar' ) ) {
$mainspan = "span12";
}
?>
The result should be loaded here, but I get a blank value:
<main class="<?php echo $mainspan; ?>">