| 512 | | <?php wp_dropdown_categories( array( 'taxonomy' => $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —' ) ); ?> |
| | 512 | <?php |
| | 513 | $parent_dropdown_args = array( |
| | 514 | 'taxonomy' => $tax_name, |
| | 515 | 'hide_empty' => 0, |
| | 516 | 'name' => 'new' . $tax_name . '_parent', |
| | 517 | 'orderby' => 'name', |
| | 518 | 'hierarchical' => 1, |
| | 519 | 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', |
| | 520 | ); |
| | 521 | /** |
| | 522 | * Filter the taxonomy parent drop-down on the Post Edit page. |
| | 523 | * |
| | 524 | * @param string|array $args { |
| | 525 | * Optional. Array or string of arguments to generate a categories drop-down element. |
| | 526 | * |
| | 527 | * @type string $show_option_all Text to display for showing all categories. Default empty. |
| | 528 | * @type string $show_option_none Text to display for showing no categories. Default empty. |
| | 529 | * @type string $option_none_value Value to use when no category is selected. Default empty. |
| | 530 | * @type string $orderby Which column to use for ordering categories. See get_terms() for a list |
| | 531 | * of accepted values. Default 'id' (term_id). |
| | 532 | * @type string $order Whether to order terms in ascending or descending order. Accepts 'ASC' |
| | 533 | * or 'DESC'. Default 'ASC'. |
| | 534 | * @type bool $pad_counts See get_terms() for an argument description. Default false. |
| | 535 | * @type bool|int $show_count Whether to include post counts. Accepts 0, 1, or their bool equivalents. |
| | 536 | * Default 0. |
| | 537 | * @type bool|int $hide_empty Whether to hide categories that don't have any posts. Accepts 0, 1, or |
| | 538 | * their bool equivalents. Default 1. |
| | 539 | * @type int $child_of Term ID to retrieve child terms of. See get_terms(). Default 0. |
| | 540 | * @type array|string $exclude Array or comma/space-separated string of term ids to exclude. |
| | 541 | * If `$include` is non-empty, `$exclude` is ignored. Default empty array. |
| | 542 | * @type bool|int $echo Whether to echo or return the generated markup. Accepts 0, 1, or their |
| | 543 | * bool equivalents. Default 1. |
| | 544 | * @type bool|int $hierarchical Whether to traverse the taxonomy hierarchy. Accepts 0, 1, or their bool |
| | 545 | * equivalents. Default 0. |
| | 546 | * @type int $depth Maximum depth. Default 0. |
| | 547 | * @type int $tab_index Tab index for the select element. Default 0 (no tabindex). |
| | 548 | * @type string $name Value for the 'name' attribute of the select element. Default 'cat'. |
| | 549 | * @type string $id Value for the 'id' attribute of the select element. Defaults to the value |
| | 550 | * of `$name`. |
| | 551 | * @type string $class Value for the 'class' attribute of the select element. Default 'postform'. |
| | 552 | * @type int|string $selected Value of the option that should be selected. Default 0. |
| | 553 | * @type string $value_field Term field that should be used to populate the 'value' attribute |
| | 554 | * of the option elements. Accepts any valid term field: 'term_id', 'name', |
| | 555 | * 'slug', 'term_group', 'term_taxonomy_id', 'taxonomy', 'description', |
| | 556 | * 'parent', 'count'. Default 'term_id'. |
| | 557 | * @type string $taxonomy Name of the category to retrieve. Default 'category'. |
| | 558 | * @type bool $hide_if_empty True to skip generating markup if no categories are found. |
| | 559 | * Default false (create select element even if no categories are found). |
| | 560 | * } |
| | 561 | * |
| | 562 | */ |
| | 563 | $parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args ); |
| | 564 | wp_dropdown_categories( $parent_dropdown_args ); |
| | 565 | ?> |