diff --git a/wp-content/themes/twentyseventeen/functions.php b/wp-content/themes/twentyseventeen/functions.php index caa5f51c89..d68dc51c8a 100644 --- a/wp-content/themes/twentyseventeen/functions.php +++ b/wp-content/themes/twentyseventeen/functions.php @@ -55,6 +55,9 @@ function twentyseventeen_setup() { add_image_size( 'twentyseventeen-thumbnail-avatar', 100, 100, true ); + // Set the default content width. + $GLOBALS['content_width'] = 525; + // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'top' => __( 'Top Menu', 'twentyseventeen' ), @@ -199,10 +202,23 @@ add_action( 'after_setup_theme', 'twentyseventeen_setup' ); */ function twentyseventeen_content_width() { - $content_width = 700; + $content_width = $GLOBALS['content_width']; - if ( twentyseventeen_is_frontpage() ) { - $content_width = 1120; + // Get layout. + $page_layout = get_theme_mod( 'page_layout' ); + + // Check if layout is one column. + if ( 'one-column' === $page_layout ) { + if ( twentyseventeen_is_frontpage() ) { + $content_width = 644; + } elseif ( is_page() ) { + $content_width = 740; + } + } + + // Check if is single post and there is no sidebar. + if ( is_single() && ! is_active_sidebar( 'sidebar-1' ) ) { + $content_width = 740; } /** @@ -214,7 +230,7 @@ function twentyseventeen_content_width() { */ $GLOBALS['content_width'] = apply_filters( 'twentyseventeen_content_width', $content_width ); } -add_action( 'after_setup_theme', 'twentyseventeen_content_width', 0 ); +add_action( 'template_redirect', 'twentyseventeen_content_width', 0 ); /** * Register custom fonts. diff --git a/wp-includes/version.php b/wp-includes/version.php index b7375d7646..52641adad4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-39626'; +$wp_version = '4.8-alpha-39635'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.