diff --git src/wp-includes/category-template.php src/wp-includes/category-template.php
index 9a2120c..3f6f700 100644
|
|
function category_description( $category = 0 ) { |
331 | 331 | * @type string $taxonomy Name of the category to retrieve. Default 'category'. |
332 | 332 | * @type bool $hide_if_empty True to skip generating markup if no categories are found. |
333 | 333 | * Default false (create select element even if no categories are found). |
| 334 | * @type bool|int $required Whether the field is required or not using HTML5 'required' attribute. Accepts 0, 1, or their bool |
334 | 335 | * } |
335 | 336 | * @return string HTML content only if 'echo' argument is 0. |
336 | 337 | */ |
337 | 338 | function wp_dropdown_categories( $args = '' ) { |
338 | 339 | $defaults = array( |
339 | | 'show_option_all' => '', 'show_option_none' => '', |
340 | | 'orderby' => 'id', 'order' => 'ASC', |
| 340 | 'show_option_all' => '', |
| 341 | 'show_option_none' => '', |
| 342 | 'option_none_value' => -1, |
| 343 | 'orderby' => 'id', |
| 344 | 'order' => 'ASC', |
341 | 345 | 'show_count' => 0, |
342 | | 'hide_empty' => 1, 'child_of' => 0, |
343 | | 'exclude' => '', 'echo' => 1, |
344 | | 'selected' => 0, 'hierarchical' => 0, |
345 | | 'name' => 'cat', 'id' => '', |
346 | | 'class' => 'postform', 'depth' => 0, |
347 | | 'tab_index' => 0, 'taxonomy' => 'category', |
348 | | 'hide_if_empty' => false, 'option_none_value' => -1, |
| 346 | 'hide_empty' => 1, |
| 347 | 'child_of' => 0, |
| 348 | 'exclude' => '', |
| 349 | 'echo' => 1, |
| 350 | 'selected' => 0, |
| 351 | 'hierarchical' => 0, |
| 352 | 'name' => 'cat', |
| 353 | 'id' => '', |
| 354 | 'class' => 'postform', |
| 355 | 'depth' => 0, |
| 356 | 'tab_index' => 0, |
| 357 | 'taxonomy' => 'category', |
| 358 | 'hide_if_empty' => false, |
349 | 359 | 'value_field' => 'term_id', |
| 360 | 'required' => false |
350 | 361 | ); |
351 | 362 | |
352 | 363 | $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0; |
… |
… |
function wp_dropdown_categories( $args = '' ) { |
379 | 390 | $name = esc_attr( $r['name'] ); |
380 | 391 | $class = esc_attr( $r['class'] ); |
381 | 392 | $id = $r['id'] ? esc_attr( $r['id'] ) : $name; |
| 393 | $required = $r['required'] ? 'required' : ''; |
382 | 394 | |
383 | 395 | if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) { |
384 | | $output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n"; |
| 396 | $output = "<select $required name='$name' id='$id' class='$class' $tab_index_attribute>\n"; |
385 | 397 | } else { |
386 | 398 | $output = ''; |
387 | 399 | } |