Ticket #39272: 39272.6.patch
File 39272.6.patch, 1.5 KB (added by , 8 years ago) |
---|
-
src/wp-content/themes/twentyseventeen/functions.php
55 55 56 56 add_image_size( 'twentyseventeen-thumbnail-avatar', 100, 100, true ); 57 57 58 // Set the default content width. 59 $GLOBALS['content_width'] = 525; 60 58 61 // This theme uses wp_nav_menu() in two locations. 59 62 register_nav_menus( array( 60 63 'top' => __( 'Top Menu', 'twentyseventeen' ), … … 199 202 */ 200 203 function twentyseventeen_content_width() { 201 204 202 $content_width = 700;205 $content_width = $GLOBALS['content_width']; 203 206 204 if ( twentyseventeen_is_frontpage() ) { 205 $content_width = 1120; 207 // Get layout. 208 $page_layout = get_theme_mod( 'page_layout' ); 209 210 // Check if layout is one column. 211 if ( 'one-column' === $page_layout ) { 212 if ( twentyseventeen_is_frontpage() ) { 213 $content_width = 644; 214 } elseif ( is_page() ) { 215 $content_width = 740; 216 } 206 217 } 207 218 219 // Check if is single post and there is no sidebar. 220 if ( is_single() && ! is_active_sidebar( 'sidebar-1' ) ) { 221 $content_width = 740; 222 } 223 208 224 /** 209 225 * Filter Twenty Seventeen content width of the theme. 210 226 * … … 214 230 */ 215 231 $GLOBALS['content_width'] = apply_filters( 'twentyseventeen_content_width', $content_width ); 216 232 } 217 add_action( ' after_setup_theme', 'twentyseventeen_content_width', 0 );233 add_action( 'template_redirect', 'twentyseventeen_content_width', 0 ); 218 234 219 235 /** 220 236 * Register custom fonts.