Permalink
Browse files

fix the js for fast preview

  • Loading branch information...
1 parent 2d788ae commit e33b9628937d943947e7ab8a93f300503a210028 @bueltge committed Oct 2, 2012
Showing with 11 additions and 16 deletions.
  1. +1 −1 footer.php
  2. +1 −1 header.php
  3. +4 −0 inc/theme-customize.php
  4. +5 −14 js/theme-customizer.js
View
@@ -12,7 +12,7 @@
<?php get_sidebar(); ?>
<div id="footer">
- <p>&copy; 2007 - <?php echo date( 'Y' ); ?> | <a href="<?php home_url( '/' ); ?>"><?php bloginfo( 'name' ); ?></a>
+ <p>&copy; 2007 - <?php echo date( 'Y' ); ?> | <a href="<?php home_url( '/' ); ?>" class="site-name"><?php bloginfo( 'name' ); ?></a>
<?php
if ( defined( 'WP_DEBUG' ) && WP_DEBUG )
echo ' | <small>' . $wpdb->num_queries . 'q, ' . timer_stop() . 's</small>';
View
@@ -41,7 +41,7 @@
<?php
// check for custom options to echo the description
if ( '1' === documentation_get_options( 'echo_desc' ) )
- echo '<p>' . get_bloginfo( 'description' ) . '</p>';
+ echo '<p class="site-description">' . get_bloginfo( 'description' ) . '</p>';
$args = array(
'theme_location' => 'primary',
@@ -98,6 +98,10 @@ public function customize_register( $wp_customize ) {
$defaults = $this->get_default_theme_options();
+ // defaults, import for live preview with js helper
+ $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
+ $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
+
$wp_customize->add_setting( $this->option_key . '[echo_desc]', array(
'default' => $defaults['echo_desc'],
'type' => 'option',
@@ -6,27 +6,18 @@
*/
( function( $ ) {
+ var api = wp.customize;
+
// Site title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
- $( '#header h1' ).html( to );
+ $( '#header h1 a, #footer a.site-name' ).html( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
- $( '.site-description' ).html( to );
- } );
- } );
-
- // Hook into background color change and adjust body class value as needed.
- wp.customize( 'background_color', function( value ) {
- value.bind( function( to ) {
- if ( '#ffffff' == to || '#fff' == to || '' == to )
- $( 'body' ).addClass( 'custom-background-white' );
- else if ( '' == to )
- $( 'body' ).addClass( 'custom-background-empty' );
- else
- $( 'body' ).removeClass( 'custom-background-empty custom-background-white' );
+ $( '#header p.site-description' ).html( to );
} );
} );
+
} )( jQuery );

0 comments on commit e33b962

Please sign in to comment.