From 9a3b25de9de070c0f6f4fe7f4d53e8da63ed0978 Mon Sep 17 00:00:00 2001 From: koopersmith Date: Fri, 25 May 2012 19:52:54 +0000 Subject: [PATCH] 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. git-svn-id: http://core.svn.wordpress.org/trunk@20912 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-control.php | 2 +- wp-includes/class-wp-customize-manager.php | 128 +++++++++++---------- 2 files changed, 69 insertions(+), 61 deletions(-) diff --git a/wp-includes/class-wp-customize-control.php b/wp-includes/class-wp-customize-control.php index 1c96ee046..04c89166d 100644 --- a/wp-includes/class-wp-customize-control.php +++ b/wp-includes/class-wp-customize-control.php @@ -404,7 +404,7 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control { public function __construct( $manager ) { parent::__construct( $manager, 'header_image', array( 'label' => __( 'Header Image' ), - 'section' => 'header', + 'section' => 'header_image', 'context' => 'custom-header', 'removed' => 'remove-header', 'get_url' => 'get_header_image', diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 37dd02fd0..17357f4c9 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -600,12 +600,40 @@ final class WP_Customize_Manager { */ public function register_controls() { - /* Custom Header */ + /* Site Title & Tagline */ - $this->add_section( 'header', array( - 'title' => __( 'Header' ), - 'theme_supports' => 'custom-header', - 'priority' => 20, + $this->add_section( 'title_tagline', array( + 'title' => __( 'Site Title & Tagline' ), + 'priority' => 20, + ) ); + + $this->add_setting( 'blogname', array( + 'default' => get_option( 'blogname' ), + 'type' => 'option', + 'capability' => 'manage_options', + ) ); + + $this->add_control( 'blogname', array( + 'label' => __( 'Site Title' ), + 'section' => 'title_tagline', + ) ); + + $this->add_setting( 'blogdescription', array( + 'default' => get_option( 'blogdescription' ), + 'type' => 'option', + 'capability' => 'manage_options', + ) ); + + $this->add_control( 'blogdescription', array( + 'label' => __( 'Tagline' ), + 'section' => 'title_tagline', + ) ); + + /* Colors */ + + $this->add_section( 'colors', array( + 'title' => __( 'Colors' ), + 'priority' => 40, ) ); $this->add_setting( 'header_textcolor', array( @@ -614,35 +642,20 @@ final class WP_Customize_Manager { 'default' => get_theme_support( 'custom-header', 'default-text-color' ), ) ); + // Input type: checkbox + // With custom value $this->add_control( 'display_header_text', array( 'settings' => 'header_textcolor', 'label' => __( 'Display Header Text' ), - 'section' => 'header', + 'section' => 'title_tagline', 'type' => 'checkbox', ) ); $this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array( 'label' => __( 'Text Color' ), - 'section' => 'header', + 'section' => 'colors', ) ) ); - // Input type: checkbox - // With custom value - $this->add_setting( 'header_image', array( - 'default' => get_theme_support( 'custom-header', 'default-image' ), - 'theme_supports' => 'custom-header', - ) ); - - $this->add_control( new WP_Customize_Header_Image_Control( $this ) ); - - /* Custom Background */ - - $this->add_section( 'background', array( - 'title' => __( 'Background' ), - 'theme_supports' => 'custom-background', - 'priority' => 30, - ) ); - // Input type: Color // With sanitize_callback $this->add_setting( 'background_color', array( @@ -653,9 +666,33 @@ final class WP_Customize_Manager { $this->add_control( new WP_Customize_Color_Control( $this, 'background_color', array( 'label' => __( 'Background Color' ), - 'section' => 'background', + 'section' => 'colors', ) ) ); + + /* Custom Header */ + + $this->add_section( 'header_image', array( + 'title' => __( 'Header Image' ), + 'theme_supports' => 'custom-header', + 'priority' => 60, + ) ); + + $this->add_setting( 'header_image', array( + 'default' => get_theme_support( 'custom-header', 'default-image' ), + 'theme_supports' => 'custom-header', + ) ); + + $this->add_control( new WP_Customize_Header_Image_Control( $this ) ); + + /* Custom Background */ + + $this->add_section( 'background_image', array( + 'title' => __( 'Background Image' ), + 'theme_supports' => 'custom-background', + 'priority' => 80, + ) ); + $this->add_setting( 'background_image', array( 'default' => get_theme_support( 'custom-background', 'default-image' ), 'theme_supports' => 'custom-background', @@ -663,7 +700,7 @@ final class WP_Customize_Manager { $this->add_control( new WP_Customize_Image_Control( $this, 'background_image', array( 'label' => __( 'Background Image' ), - 'section' => 'background', + 'section' => 'background_image', 'context' => 'custom-background', ) ) ); @@ -674,7 +711,7 @@ final class WP_Customize_Manager { $this->add_control( 'background_repeat', array( 'label' => __( 'Background Repeat' ), - 'section' => 'background', + 'section' => 'background_image', 'type' => 'radio', 'choices' => array( 'no-repeat' => __('No Repeat'), @@ -691,7 +728,7 @@ final class WP_Customize_Manager { $this->add_control( 'background_position_x', array( 'label' => __( 'Background Position' ), - 'section' => 'background', + 'section' => 'background_image', 'type' => 'radio', 'choices' => array( 'left' => __('Left'), @@ -707,7 +744,7 @@ final class WP_Customize_Manager { $this->add_control( 'background_attachment', array( 'label' => __( 'Background Attachment' ), - 'section' => 'background', + 'section' => 'background_image', 'type' => 'radio', 'choices' => array( 'fixed' => __('Fixed'), @@ -733,7 +770,7 @@ final class WP_Customize_Manager { $this->add_section( 'nav', array( 'title' => __( 'Navigation' ), 'theme_supports' => 'menus', - 'priority' => 40, + 'priority' => 100, '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.'), ) ); @@ -768,7 +805,7 @@ final class WP_Customize_Manager { $this->add_section( 'static_front_page', array( 'title' => __( 'Static Front Page' ), // 'theme_supports' => 'static-front-page', - 'priority' => 50, + 'priority' => 120, 'description' => __( 'Your theme supports a static front page.' ), ) ); @@ -812,35 +849,6 @@ final class WP_Customize_Manager { 'section' => 'static_front_page', 'type' => 'dropdown-pages', ) ); - - /* Site Title & Tagline */ - - $this->add_section( 'strings', array( - 'title' => __( 'Site Title & Tagline' ), - 'priority' => 5, - ) ); - - $this->add_setting( 'blogname', array( - 'default' => get_option( 'blogname' ), - 'type' => 'option', - 'capability' => 'manage_options', - ) ); - - $this->add_control( 'blogname', array( - 'label' => __( 'Site Title' ), - 'section' => 'strings', - ) ); - - $this->add_setting( 'blogdescription', array( - 'default' => get_option( 'blogdescription' ), - 'type' => 'option', - 'capability' => 'manage_options', - ) ); - - $this->add_control( 'blogdescription', array( - 'label' => __( 'Tagline' ), - 'section' => 'strings', - ) ); } };