Ticket #23586: 23586.diff
| File 23586.diff, 2.9 KB (added by , 13 years ago) |
|---|
-
wp-content/themes/twentytwelve/functions.php
383 383 */ 384 384 function twentytwelve_body_class( $classes ) { 385 385 $background_color = get_background_color(); 386 $background_image = get_background_image(); 386 387 387 388 if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) ) 388 389 $classes[] = 'full-width'; … … 395 396 $classes[] = 'two-sidebars'; 396 397 } 397 398 398 if ( empty( $background_color ) ) 399 $classes[] = 'custom-background-empty'; 400 elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) 401 $classes[] = 'custom-background-white'; 399 if ( empty( $background_image ) ) { 400 if ( empty( $background_color ) ) 401 $classes[] = 'custom-background-empty'; 402 elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) 403 $classes[] = 'custom-background-white'; 404 } 402 405 403 406 // Enable custom font class only if the font CSS is queued to load. 404 407 if ( wp_style_is( 'twentytwelve-fonts', 'queue' ) ) -
wp-content/themes/twentytwelve/js/theme-customizer.js
18 18 } ); 19 19 } ); 20 20 21 // Hook into background color change and adjust body class value as needed.21 // Hook into background color/image change and adjust body class value as needed. 22 22 wp.customize( 'background_color', function( value ) { 23 23 value.bind( function( to ) { 24 if ( '#ffffff' == to || '#fff' == to ) 25 $( 'body' ).addClass( 'custom-background-white' ); 26 else if ( '' == to ) 27 $( 'body' ).addClass( 'custom-background-empty' ); 24 var body = $( 'body' ); 25 26 if ( ( '#ffffff' == to || '#fff' == to ) && 'none' == body.css( 'background-image' ) ) 27 body.addClass( 'custom-background-white' ); 28 else if ( '' == to && 'none' == body.css( 'background-image' ) ) 29 body.addClass( 'custom-background-empty' ); 28 30 else 29 $( 'body' ).removeClass( 'custom-background-empty custom-background-white' );31 body.removeClass( 'custom-background-empty custom-background-white' ); 30 32 } ); 31 33 } ); 32 } )( jQuery ); 33 No newline at end of file 34 wp.customize( 'background_image', function( value ) { 35 value.bind( function( to ) { 36 var body = $( 'body' ); 37 38 if ( '' != to ) 39 body.removeClass( 'custom-background-empty custom-background-white' ); 40 else if ( 'rgb(255, 255, 255)' == body.css( 'background-color' ) ) 41 body.addClass( 'custom-background-white' ); 42 else if ( 'rgb(230, 230, 230)' == body.css( 'background-color' ) && '' == _wpCustomizeSettings.values.background_color ) 43 body.addClass( 'custom-background-empty' ); 44 } ); 45 } ); 46 } )( jQuery );