Make WordPress Core

Changeset 20912


Ignore:
Timestamp:
05/25/2012 07:52:54 PM (14 years ago)
Author:
koopersmith
Message:

Theme Customizer: Section reorganization. see #19910.

Now that sections are organized in accordions, group items by size and usage.
Move header/background controls into colors, header image, background image, and title/tagline sections.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-control.php

    r20830 r20912  
    405405                parent::__construct( $manager, 'header_image', array(
    406406                        'label'    => __( 'Header Image' ),
    407                         'section'  => 'header',
     407                        'section'  => 'header_image',
    408408                        'context'  => 'custom-header',
    409409                        'removed'  => 'remove-header',
  • trunk/wp-includes/class-wp-customize-manager.php

    r20910 r20912  
    601601        public function register_controls() {
    602602
    603                 /* Custom Header */
    604 
    605                 $this->add_section( 'header', array(
    606                         'title'          => __( 'Header' ),
    607                         'theme_supports' => 'custom-header',
    608                         'priority'       => 20,
     603                /* Site Title & Tagline */
     604
     605                $this->add_section( 'title_tagline', array(
     606                        'title'    => __( 'Site Title & Tagline' ),
     607                        'priority' => 20,
     608                ) );
     609
     610                $this->add_setting( 'blogname', array(
     611                        'default'    => get_option( 'blogname' ),
     612                        'type'       => 'option',
     613                        'capability' => 'manage_options',
     614                ) );
     615
     616                $this->add_control( 'blogname', array(
     617                        'label'      => __( 'Site Title' ),
     618                        'section'    => 'title_tagline',
     619                ) );
     620
     621                $this->add_setting( 'blogdescription', array(
     622                        'default'    => get_option( 'blogdescription' ),
     623                        'type'       => 'option',
     624                        'capability' => 'manage_options',
     625                ) );
     626
     627                $this->add_control( 'blogdescription', array(
     628                        'label'      => __( 'Tagline' ),
     629                        'section'    => 'title_tagline',
     630                ) );
     631
     632                /* Colors */
     633
     634                $this->add_section( 'colors', array(
     635                        'title'          => __( 'Colors' ),
     636                        'priority'       => 40,
    609637                ) );
    610638
    … …  
    615643                ) );
    616644
     645                // Input type: checkbox
     646                // With custom value
    617647                $this->add_control( 'display_header_text', array(
    618648                        'settings' => 'header_textcolor',
    619649                        'label'    => __( 'Display Header Text' ),
    620                         'section'  => 'header',
     650                        'section'  => 'title_tagline',
    621651                        'type'     => 'checkbox',
    622652                ) );
    … …  
    624654                $this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array(
    625655                        'label'   => __( 'Text Color' ),
    626                         'section' => 'header',
     656                        'section' => 'colors',
    627657                ) ) );
    628 
    629                 // Input type: checkbox
    630                 // With custom value
    631                 $this->add_setting( 'header_image', array(
    632                         'default'        => get_theme_support( 'custom-header', 'default-image' ),
    633                         'theme_supports' => 'custom-header',
    634                 ) );
    635 
    636                 $this->add_control( new WP_Customize_Header_Image_Control( $this ) );
    637 
    638                 /* Custom Background */
    639 
    640                 $this->add_section( 'background', array(
    641                         'title'          => __( 'Background' ),
    642                         'theme_supports' => 'custom-background',
    643                         'priority'       => 30,
    644                 ) );
    645658
    646659                // Input type: Color
    … …  
    654667                $this->add_control( new WP_Customize_Color_Control( $this, 'background_color', array(
    655668                        'label'   => __( 'Background Color' ),
    656                         'section' => 'background',
     669                        'section' => 'colors',
    657670                ) ) );
     671
     672
     673                /* Custom Header */
     674
     675                $this->add_section( 'header_image', array(
     676                        'title'          => __( 'Header Image' ),
     677                        'theme_supports' => 'custom-header',
     678                        'priority'       => 60,
     679                ) );
     680
     681                $this->add_setting( 'header_image', array(
     682                        'default'        => get_theme_support( 'custom-header', 'default-image' ),
     683                        'theme_supports' => 'custom-header',
     684                ) );
     685
     686                $this->add_control( new WP_Customize_Header_Image_Control( $this ) );
     687
     688                /* Custom Background */
     689
     690                $this->add_section( 'background_image', array(
     691                        'title'          => __( 'Background Image' ),
     692                        'theme_supports' => 'custom-background',
     693                        'priority'       => 80,
     694                ) );
    658695
    659696                $this->add_setting( 'background_image', array(
    … …  
    664701                $this->add_control( new WP_Customize_Image_Control( $this, 'background_image', array(
    665702                        'label'          => __( 'Background Image' ),
    666                         'section'        => 'background',
     703                        'section'        => 'background_image',
    667704                        'context'        => 'custom-background',
    668705                ) ) );
    … …  
    675712                $this->add_control( 'background_repeat', array(
    676713                        'label'      => __( 'Background Repeat' ),
    677                         'section'    => 'background',
     714                        'section'    => 'background_image',
    678715                        'type'       => 'radio',
    679716                        'choices'    => array(
    … …  
    692729                $this->add_control( 'background_position_x', array(
    693730                        'label'      => __( 'Background Position' ),
    694                         'section'    => 'background',
     731                        'section'    => 'background_image',
    695732                        'type'       => 'radio',
    696733                        'choices'    => array(
    … …  
    708745                $this->add_control( 'background_attachment', array(
    709746                        'label'      => __( 'Background Attachment' ),
    710                         'section'    => 'background',
     747                        'section'    => 'background_image',
    711748                        'type'       => 'radio',
    712749                        'choices'    => array(
    … …  
    734771                        'title'          => __( 'Navigation' ),
    735772                        'theme_supports' => 'menus',
    736                         'priority'       => 40,
     773                        'priority'       => 100,
    737774                        'description'    => sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.'),
    738775                ) );
    … …  
    769806                        'title'          => __( 'Static Front Page' ),
    770807                //      'theme_supports' => 'static-front-page',
    771                         'priority'       => 50,
     808                        'priority'       => 120,
    772809                        'description'    => __( 'Your theme supports a static front page.' ),
    773810                ) );
    … …  
    813850                        'type'       => 'dropdown-pages',
    814851                ) );
    815 
    816                 /* Site Title & Tagline */
    817 
    818                 $this->add_section( 'strings', array(
    819                         'title'    => __( 'Site Title & Tagline' ),
    820                         'priority' => 5,
    821                 ) );
    822 
    823                 $this->add_setting( 'blogname', array(
    824                         'default'    => get_option( 'blogname' ),
    825                         'type'       => 'option',
    826                         'capability' => 'manage_options',
    827                 ) );
    828 
    829                 $this->add_control( 'blogname', array(
    830                         'label'      => __( 'Site Title' ),
    831                         'section'    => 'strings',
    832                 ) );
    833 
    834                 $this->add_setting( 'blogdescription', array(
    835                         'default'    => get_option( 'blogdescription' ),
    836                         'type'       => 'option',
    837                         'capability' => 'manage_options',
    838                 ) );
    839 
    840                 $this->add_control( 'blogdescription', array(
    841                         'label'      => __( 'Tagline' ),
    842                         'section'    => 'strings',
    843                 ) );
    844852        }
    845853};
Note: See TracChangeset for help on using the changeset viewer.