- Timestamp:
- 09/25/2013 04:49:36 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyeleven/inc/theme-options.php
r20936 r25625 15 15 * @since Twenty Eleven 1.0 16 16 * 17 * @param string $hook_suffix An admin page's hook suffix. 17 18 */ 18 19 function twentyeleven_admin_enqueue_scripts( $hook_suffix ) { … … 52 53 // Register our individual settings fields 53 54 add_settings_field( 54 'color_scheme', // Unique identifier for the field for this section55 __( 'Color Scheme', 'twentyeleven' ), // Setting field label55 'color_scheme', // Unique identifier for the field for this section 56 __( 'Color Scheme', 'twentyeleven' ), // Setting field label 56 57 'twentyeleven_settings_field_color_scheme', // Function that renders the settings field 57 'theme_options', // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()58 'general' // Settings section. Same as the first argument in the add_settings_section() above58 '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 59 60 ); 60 61 … … 67 68 * Change the capability required to save the 'twentyeleven_options' options group. 68 69 * 69 * @see twentyeleven_theme_options_init() First parameter to register_setting() is the name of the options group.70 * @see twentyeleven_theme_options_init() First parameter to register_setting() is the name of the options group. 70 71 * @see twentyeleven_theme_options_add_page() The edit_theme_options capability is used for viewing the page. 71 72 * … … 84 85 85 86 /** 86 * Add ourtheme options page to the admin menu, including some help documentation.87 * Add a theme options page to the admin menu, including some help documentation. 87 88 * 88 89 * This function is attached to the admin_menu action hook. … … 123 124 124 125 if ( method_exists( $screen, 'add_help_tab' ) ) { 125 // WordPress 3.3 126 // WordPress 3.3.0 126 127 $screen->add_help_tab( array( 127 128 'title' => __( 'Overview', 'twentyeleven' ), … … 133 134 $screen->set_help_sidebar( $sidebar ); 134 135 } else { 135 // WordPress 3.2 136 // WordPress 3.2.0 136 137 add_contextual_help( $screen, $help . $sidebar ); 137 138 } … … 139 140 140 141 /** 141 * Return san array of color schemes registered for Twenty Eleven.142 * Return an array of color schemes registered for Twenty Eleven. 142 143 * 143 144 * @since Twenty Eleven 1.0 … … 159 160 ); 160 161 162 /** 163 * Filter the Twenty Eleven color scheme options. 164 * 165 * @since Twenty Eleven 1.0 166 * 167 * @param array $color_scheme_options An associative array of color scheme options. 168 */ 161 169 return apply_filters( 'twentyeleven_color_schemes', $color_scheme_options ); 162 170 } 163 171 164 172 /** 165 * Return san array of layout options registered for Twenty Eleven.173 * Return an array of layout options registered for Twenty Eleven. 166 174 * 167 175 * @since Twenty Eleven 1.0 … … 186 194 ); 187 195 196 /** 197 * Filter the Twenty Eleven layout options. 198 * 199 * @since Twenty Eleven 1.0 200 * 201 * @param array $layout_options An associative array of layout options. 202 */ 188 203 return apply_filters( 'twentyeleven_layouts', $layout_options ); 189 204 } 190 205 191 206 /** 192 * Returns the default options for Twenty Eleven. 193 * 194 * @since Twenty Eleven 1.0 207 * Return the default options for Twenty Eleven. 208 * 209 * @since Twenty Eleven 1.0 210 * 211 * @return array An array of default theme options. 195 212 */ 196 213 function twentyeleven_get_default_theme_options() { … … 204 221 $default_theme_options['theme_layout'] = 'sidebar-content'; 205 222 223 /** 224 * Filter the Twenty Eleven default options. 225 * 226 * @since Twenty Eleven 1.0 227 * 228 * @param array $default_theme_options An array of default theme options. 229 */ 206 230 return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options ); 207 231 } 208 232 209 233 /** 210 * Returns the default link color for Twenty Eleven, based on color scheme. 211 * 212 * @since Twenty Eleven 1.0 213 * 214 * @param $string $color_scheme Color scheme. Defaults to the active color scheme. 215 * @return $string Color. 234 * Return the default link color for Twenty Eleven, based on color scheme. 235 * 236 * @since Twenty Eleven 1.0 237 * 238 * @param string $color_scheme Optional. Color scheme. 239 * Default null (or the active color scheme). 240 * @return string The default link color. 216 241 */ 217 242 function twentyeleven_get_default_link_color( $color_scheme = null ) { … … 229 254 230 255 /** 231 * Return sthe options array for Twenty Eleven.256 * Return the options array for Twenty Eleven. 232 257 * 233 258 * @since Twenty Eleven 1.0 … … 238 263 239 264 /** 240 * Render sthe Color Scheme setting field.265 * Render the Color Scheme setting field. 241 266 * 242 267 * @since Twenty Eleven 1.3 … … 262 287 263 288 /** 264 * Render sthe Link Color setting field.289 * Render the Link Color setting field. 265 290 * 266 291 * @since Twenty Eleven 1.3 … … 279 304 280 305 /** 281 * Render sthe Layout setting field.306 * Render the Layout setting field. 282 307 * 283 308 * @since Twenty Eleven 1.3 … … 301 326 302 327 /** 303 * Return sthe options array for Twenty Eleven.328 * Return the options array for Twenty Eleven. 304 329 * 305 330 * @since Twenty Eleven 1.2 … … 325 350 326 351 /** 327 * Sanitize and validate form input. Accepts an array, return a sanitized array. 352 * Sanitize and validate form input. 353 * 354 * Accepts an array, return a sanitized array. 328 355 * 329 356 * @see twentyeleven_theme_options_init() … … 331 358 * 332 359 * @since Twenty Eleven 1.0 360 * 361 * @param array $input An array of form input. 333 362 */ 334 363 function twentyeleven_theme_options_validate( $input ) { … … 350 379 $output['theme_layout'] = $input['theme_layout']; 351 380 381 /** 382 * Filter the Twenty Eleven sanitized form input array. 383 * 384 * @since Twenty Eleven 1.0 385 * 386 * @param array $output An array of sanitized form output. 387 * @param array $input An array of un-sanitized form input. 388 * @param array $defaults An array of default theme options. 389 */ 352 390 return apply_filters( 'twentyeleven_theme_options_validate', $output, $input, $defaults ); 353 391 } … … 365 403 wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null ); 366 404 405 /** 406 * Fires after the styles for the Twenty Eleven color scheme are enqueued. 407 * 408 * @since Twenty Eleven 1.0 409 * 410 * @param string $color_scheme The color scheme. 411 */ 367 412 do_action( 'twentyeleven_enqueue_color_scheme', $color_scheme ); 368 413 } … … 418 463 419 464 /** 420 * Adds Twenty Eleven layout classes to the array of body classes. 421 * 422 * @since Twenty Eleven 1.0 465 * Add Twenty Eleven layout classes to the array of body classes. 466 * 467 * @since Twenty Eleven 1.0 468 * 469 * @param array $existing_classes An array of existing body classes. 423 470 */ 424 471 function twentyeleven_layout_classes( $existing_classes ) { … … 438 485 $classes[] = $current_layout; 439 486 487 /** 488 * Filter the Twenty Eleven layout body classes. 489 * 490 * @since Twenty Eleven 1.0 491 * 492 * @param array $classes An array of body classes. 493 * @param string $current_layout The current theme layout. 494 */ 440 495 $classes = apply_filters( 'twentyeleven_layout_classes', $classes, $current_layout ); 441 496 … … 447 502 * Implements Twenty Eleven theme options into Theme Customizer 448 503 * 449 * @param $wp_customize Theme Customizer object 504 * @since Twenty Eleven 1.3 505 * 506 * @param object $wp_customize Theme Customizer object. 450 507 * @return void 451 508 * 452 * @since Twenty Eleven 1.3453 509 */ 454 510 function twentyeleven_customize_register( $wp_customize ) { … … 522 578 /** 523 579 * Bind JS handlers to make Theme Customizer preview reload changes asynchronously. 580 * 524 581 * Used with blogname and blogdescription. 525 582 *
Note: See TracChangeset
for help on using the changeset viewer.