Make WordPress Core

Ticket #20448: 20448.diff

File 20448.diff, 3.9 KB (added by nacin, 13 years ago)
  • wp-includes/class-wp-customize.php

     
    102102         * @since 3.4.0
    103103         */
    104104        public function wp_loaded() {
    105                 do_action( 'customize_register' );
     105                do_action( 'customize_register', $this );
    106106
    107107                if ( $this->is_preview() && ! is_admin() )
    108108                        $this->customize_preview_init();
  • wp-includes/theme.php

     
    15781578        require( ABSPATH . WPINC . '/class-wp-customize.php' );
    15791579        // Init Customize class
    15801580        // @todo Dependency injection instead
    1581         $GLOBALS['customize'] = new WP_Customize;
     1581        $GLOBALS['wp_customize'] = new WP_Customize;
    15821582}
    15831583add_action( 'plugins_loaded', '_wp_customize_include' );
    15841584
  • wp-content/themes/twentyeleven/inc/theme-options.php

     
    186186                ),
    187187                'content' => array(
    188188                        'value' => 'content',
    189                         'label' => __( 'One-column, no sidebar', 'twentyeleven' ),
     189                        'label' => __( 'One column, no sidebar', 'twentyeleven' ),
    190190                        'thumbnail' => get_template_directory_uri() . '/inc/images/content.png',
    191191                ),
    192192        );
     
    389389        // Don't do anything if the current link color is the default.
    390390        if ( $default_options['link_color'] == $link_color )
    391391                return;
     392        $link_color = '#' . ltrim( $link_color, '#' );
    392393?>
    393394        <style>
    394395                /* Link color */
     
    446447
    447448        return array_merge( $existing_classes, $classes );
    448449}
    449 add_filter( 'body_class', 'twentyeleven_layout_classes' );
    450  No newline at end of file
     450add_filter( 'body_class', 'twentyeleven_layout_classes' );
     451
     452function twentyeleven_customize_register( $customize ) {
     453        $defaults = twentyeleven_get_default_theme_options();
     454
     455        $customize->add_section( 'twentyeleven_colors', array(
     456                'title' => __( 'Colors', 'twentyeleven' ),
     457                'priority' => 33,
     458        ) );
     459
     460        $customize->add_setting( 'twentyeleven_theme_options[color_scheme]', array(
     461                'type' => 'option',
     462                'default' => $defaults['color_scheme'],
     463                'sanitize_callback' => 'sanitize_key',
     464        ) );
     465
     466        $customize->add_control( 'twentyeleven_theme_options[color_scheme]', array(
     467                'section' => 'twentyeleven_colors',
     468                'label' => __( 'Color Scheme', 'twentyeleven'),
     469                'type'       => 'radio',
     470                'choices'    => array(
     471                        'light' => __('Light', 'twentyeleven'),
     472                        'dark'  => __('Dark', 'twentyeleven'),
     473                ),
     474        ) );
     475
     476        $customize->add_setting( 'twentyeleven_theme_options[link_color]', array(
     477                'type' => 'option',
     478                'default' => $defaults['link_color'],
     479                'sanitize_callback' => 'sanitize_hexcolor',
     480        ) );
     481
     482        $customize->add_control( 'twentyeleven_theme_options[link_color]', array(
     483                'section' => 'twentyeleven_colors',
     484                'label' => __( 'Link Color', 'twentyeleven' ),
     485                'type' => 'color',
     486        ) );
     487
     488        $customize->add_section( 'twentyeleven_layout', array(
     489                'title'    => __( 'Default Layout', 'twentyeleven' ),
     490                'priority' => 35,
     491        ) );
     492
     493        $customize->add_setting( 'twentyeleven_theme_options[theme_layout]', array(
     494                'type'              => 'option',
     495                'default'           => $defaults['theme_layout'],
     496                'sanitize_callback' => 'sanitize_key',
     497        ) );
     498
     499        $customize->add_control( 'twentyeleven_theme_options[theme_layout]', array(
     500                'section' => 'twentyeleven_layout',
     501                'type'       => 'radio',
     502                'choices'    => array(
     503                        'content-sidebar'  => __('Content on left', 'twentyeleven'),
     504                        'sidebar-content'  => __('Content on right', 'twentyeleven'),
     505                        'content'          => __('One column, no sidebar', 'twentyeleven'),
     506                ),
     507        ) );
     508}
     509add_action( 'customize_register', 'twentyeleven_customize_register' );