Changeset 37465 for trunk/src/wp-includes/category-template.php
- Timestamp:
- 05/19/2016 02:38:33 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/category-template.php
r37463 r37465 315 315 * @since 2.1.0 316 316 * @since 4.2.0 Introduced the `value_field` argument. 317 * @since 4.6.0 Introduced the `required` argument. 317 318 * 318 319 * @param string|array $args { … … 352 353 * @type bool $hide_if_empty True to skip generating markup if no categories are found. 353 354 * Default false (create select element even if no categories are found). 355 * @type bool $required Whether the <select> element should have the HTML5 'required' attribute. 356 * Default false. 354 357 * } 355 358 * @return string HTML content only if 'echo' argument is 0. … … 377 380 'option_none_value' => -1, 378 381 'value_field' => 'term_id', 382 'required' => false, 379 383 ); 380 384 … … 415 419 $class = esc_attr( $r['class'] ); 416 420 $id = $r['id'] ? esc_attr( $r['id'] ) : $name; 421 $required = $r['required'] ? 'required' : ''; 417 422 418 423 if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) { 419 $output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n";424 $output = "<select $required name='$name' id='$id' class='$class' $tab_index_attribute>\n"; 420 425 } else { 421 426 $output = '';
Note: See TracChangeset
for help on using the changeset viewer.