| 589 | function twentyeleven_customize_include() { |
| 590 | global $wp_customize; |
| 591 | if ( !isset( $wp_customize ) ) |
| 592 | return; |
| 593 | |
| 594 | $sett = $wp_customize->get_setting('blogname'); |
| 595 | $sett->transport='postMessage'; |
| 596 | |
| 597 | $sett = $wp_customize->get_setting('blogdescription'); |
| 598 | $sett->transport='postMessage'; |
| 599 | |
| 600 | $sett = $wp_customize->get_setting('header_textcolor'); |
| 601 | $sett->transport='postMessage'; |
| 602 | } |
| 603 | add_action( 'customize_register', 'twentyeleven_customize_include' ); |
| 604 | |
| 605 | function twentyeleven_customize_footer() { |
| 606 | add_action( 'wp_footer', 'twentyeleven_customize_preview', 21); |
| 607 | } |
| 608 | add_action( 'customize_preview_init', 'twentyeleven_customize_footer' ); |
| 609 | |
| 610 | function twentyeleven_customize_preview() { |
| 611 | ?> |
| 612 | <script type="text/javascript"> |
| 613 | wp.customize('blogname',function( value ) { |
| 614 | value.bind(function(to) { |
| 615 | jQuery('#site-title a').html(to); |
| 616 | }); |
| 617 | }); |
| 618 | wp.customize('blogdescription',function( value ) { |
| 619 | value.bind(function(to) { |
| 620 | jQuery('#site-description').html(to); |
| 621 | }); |
| 622 | }); |
| 623 | wp.customize( 'header_textcolor', function( value ) { |
| 624 | value.bind( function( to ) { |
| 625 | jQuery('#site-title a, #site-description').css('color', to ? '#' + to : '' ); |
| 626 | }); |
| 627 | }); |
| 628 | </script> |
| 629 | <?php |
| 630 | } |