Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function twentyeleven_customizer_options($wp_customize) {
- $wp_customize->add_section( 'twentyeleven_color_scheme', array(
- 'title' => __( 'Colors', 'twentyeleven' ),
- 'priority' => 35,
- ));
- $wp_customize->add_setting( 'twentyeleven_theme_options[text_color]', array(
- 'default' => '#000000',
- 'type' => 'option',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'text_color', array(
- 'label' => __( 'Text Color', 'twentyeleven' ),
- 'section' => 'twentyeleven_color_scheme',
- 'settings' => 'twentyeleven_theme_options[text_color]',
- ) ) );
- $wp_customize->get_setting('twentyeleven_theme_options[text_color]')->transport='postMessage';
- if ( $wp_customize->is_preview() && ! is_admin() )
- add_action( 'wp_footer', 'twentyeleven_customize_preview', 21);
- }
- add_action( 'customize_register', 'twentyeleven_customizer_options' );
- function twentyeleven_customize_preview() {
- ?>
- <script type="text/javascript">
- wp.customize( 'twentyeleven_theme_options[text_color]', function( value ) {
- value.bind(function(to) {
- jQuery('body').css('color', to );
- });
- });
- </script>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement