- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyeleven/inc/theme-options.php
r45932 r47122 38 38 39 39 register_setting( 40 'twentyeleven_options', // Options group, see settings_fields() call in twentyeleven_theme_options_render_page()41 'twentyeleven_theme_options', // Database option, see twentyeleven_get_theme_options()42 'twentyeleven_theme_options_validate' // The sanitization callback, see twentyeleven_theme_options_validate() 43 ); 44 45 // Register our settings field group 40 'twentyeleven_options', // Options group, see settings_fields() call in twentyeleven_theme_options_render_page(). 41 'twentyeleven_theme_options', // Database option, see twentyeleven_get_theme_options(). 42 'twentyeleven_theme_options_validate' // The sanitization callback, see twentyeleven_theme_options_validate(). 43 ); 44 45 // Register our settings field group. 46 46 add_settings_section( 47 'general', // Unique identifier for the settings section48 '', // Section title (we don't want one)49 '__return_false', // Section callback (we don't want anything) 50 'theme_options' // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()51 ); 52 53 // Register our individual settings fields 47 'general', // Unique identifier for the settings section. 48 '', // Section title (we don't want one). 49 '__return_false', // Section callback (we don't want anything). 50 'theme_options' // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page(). 51 ); 52 53 // Register our individual settings fields. 54 54 add_settings_field( 55 'color_scheme', // Unique identifier for the field for this section 56 __( 'Color Scheme', 'twentyeleven' ), // Setting field label 57 'twentyeleven_settings_field_color_scheme', // Function that renders the settings field 58 'theme_options', // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page() 59 'general' // Settings section. Same as the first argument in the add_settings_section() above 55 'color_scheme', // Unique identifier for the field for this section. 56 __( 'Color Scheme', 'twentyeleven' ), // Setting field label. 57 'twentyeleven_settings_field_color_scheme', // Function that renders the settings field. 58 'theme_options', // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page(). 59 'general' // Settings section. Same as the first argument in the add_settings_section() above. 60 60 ); 61 61 … … 93 93 function twentyeleven_theme_options_add_page() { 94 94 $theme_page = add_theme_page( 95 __( 'Theme Options', 'twentyeleven' ), // Name of page 96 __( 'Theme Options', 'twentyeleven' ), // Label in menu 97 'edit_theme_options', // Capability required 98 'theme_options', // Menu slug, used to uniquely identify the page 99 'twentyeleven_theme_options_render_page' // Function that renders the options page 95 __( 'Theme Options', 'twentyeleven' ), // Name of page. 96 __( 'Theme Options', 'twentyeleven' ), // Label in menu. 97 'edit_theme_options', // Capability required. 98 'theme_options', // Menu slug, used to uniquely identify the page. 99 'twentyeleven_theme_options_render_page' // Function that renders the options page. 100 100 ); 101 101 … … 125 125 126 126 if ( method_exists( $screen, 'add_help_tab' ) ) { 127 // WordPress 3.3.0 127 // WordPress 3.3.0. 128 128 $screen->add_help_tab( 129 129 array( … … 136 136 $screen->set_help_sidebar( $sidebar ); 137 137 } else { 138 // WordPress 3.2.0 138 // WordPress 3.2.0. 139 139 add_contextual_help( $screen, $help . $sidebar ); 140 140 } … … 379 379 $output = $defaults; 380 380 381 // Color scheme must be in our array of color scheme options 381 // Color scheme must be in our array of color scheme options. 382 382 if ( isset( $input['color_scheme'] ) && array_key_exists( $input['color_scheme'], twentyeleven_color_schemes() ) ) { 383 383 $output['color_scheme'] = $input['color_scheme']; … … 388 388 $output['link_color'] = $defaults['link_color']; 389 389 390 // Link color must be 3 or 6 hexadecimal characters 390 // Link color must be 3 or 6 hexadecimal characters. 391 391 if ( isset( $input['link_color'] ) && preg_match( '/^#?([a-f0-9]{3}){1,2}$/i', $input['link_color'] ) ) { 392 392 $output['link_color'] = '#' . strtolower( ltrim( $input['link_color'], '#' ) ); 393 393 } 394 394 395 // Theme layout must be in our array of theme layout options 395 // Theme layout must be in our array of theme layout options. 396 396 if ( isset( $input['theme_layout'] ) && array_key_exists( $input['theme_layout'], twentyeleven_layouts() ) ) { 397 397 $output['theme_layout'] = $input['theme_layout']; … … 583 583 ); 584 584 585 // Link Color (added to Color Scheme section in Customizer) 585 // Link Color (added to Color Scheme section in Customizer). 586 586 $wp_customize->add_setting( 587 587 'twentyeleven_theme_options[link_color]', … … 606 606 ); 607 607 608 // Default Layout 608 // Default Layout. 609 609 $wp_customize->add_section( 610 610 'twentyeleven_layout',
Note: See TracChangeset
for help on using the changeset viewer.