Created
May 8, 2013 04:56
-
-
Save itsdavidmorgan/5538285 to your computer and use it in GitHub Desktop.
Content width with active sidebars
This file contains hidden or 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
function photographer_content_width() { | |
if ( ! is_single() || is_active_sidebar( 'post-sidebar' ) ) { | |
global $content_width; | |
$content_width = 900; | |
} | |
if ( ! is_home() || is_archive() || is_active_sidebar( 'blog-sidebar' ) ) { | |
global $content_width; | |
$content_width = 900; | |
} | |
if ( ! is_page() || is_active_sidebar( 'page-sidebar' ) ) { | |
global $content_width; | |
$content_width = 900; | |
} | |
if ( ! is_front_page() || is_page_template('template-home.php') || is_active_sidebar( 'home-sidebar' ) ) { | |
global $content_width; | |
$content_width = 900; | |
} | |
} | |
add_action( 'template_redirect', 'photographer_content_width' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment