Changeset 43571 for trunk/src/wp-admin/edit-tags.php
- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/edit-tags.php
r42719 r43571 56 56 57 57 add_screen_option( 58 'per_page', array( 58 'per_page', 59 array( 59 60 'default' => 20, 60 61 'option' => 'edit_' . $tax->name . '_per_page', … … 96 97 'error' => true, 97 98 'message' => 4, 98 ), $referer 99 ), 100 $referer 99 101 ); 100 102 } … … 188 190 'error' => true, 189 191 'message' => 5, 190 ), $referer 192 ), 193 $referer 191 194 ); 192 195 } … … 338 341 <?php if ( $message ) : ?> 339 342 <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div> 340 <?php341 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] );343 <?php 344 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); 342 345 endif; 343 346 ?> … … 402 405 */ 403 406 do_action( "{$taxonomy}_pre_add_form", $taxonomy ); 404 ?>407 ?> 405 408 406 409 <div class="form-wrap"> 407 410 <h2><?php echo $tax->labels->add_new_item; ?></h2> 408 411 <form id="addtag" method="post" action="edit-tags.php" class="validate" 409 <?php410 /**411 * Fires inside the Add Tag form tag.412 *413 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.414 *415 * @since 3.7.0416 */417 do_action( "{$taxonomy}_term_new_form_tag" );418 ?>412 <?php 413 /** 414 * Fires inside the Add Tag form tag. 415 * 416 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 417 * 418 * @since 3.7.0 419 */ 420 do_action( "{$taxonomy}_term_new_form_tag" ); 421 ?> 419 422 > 420 423 <input type="hidden" name="action" value="add-tag" /> … … 422 425 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" /> 423 426 <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" /> 424 <?php wp_nonce_field( 'add-tag', '_wpnonce_add-tag' ); ?>427 <?php wp_nonce_field( 'add-tag', '_wpnonce_add-tag' ); ?> 425 428 426 429 <div class="form-field form-required term-name-wrap"> … … 429 432 <p><?php _e( 'The name is how it appears on your site.' ); ?></p> 430 433 </div> 431 <?php if ( ! global_terms_enabled() ) : ?>434 <?php if ( ! global_terms_enabled() ) : ?> 432 435 <div class="form-field term-slug-wrap"> 433 436 <label for="tag-slug"><?php _e( 'Slug' ); ?></label> … … 436 439 </div> 437 440 <?php endif; // global_terms_enabled() ?> 438 <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?>441 <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> 439 442 <div class="form-field term-parent-wrap"> 440 443 <label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label> 441 <?php442 $dropdown_args = array(443 'hide_empty' => 0,444 'hide_if_empty' => false,445 'taxonomy' => $taxonomy,446 'name' => 'parent',447 'orderby' => 'name',448 'hierarchical' => true,449 'show_option_none' => __( 'None' ),450 );451 452 /**453 * Filters the taxonomy parent drop-down on the Edit Term page.454 *455 * @since 3.7.0456 * @since 4.2.0 Added `$context` parameter.457 *458 * @param array $dropdown_args {459 * An array of taxonomy parent drop-down arguments.460 *461 * @type int|bool $hide_empty Whether to hide terms not attached to any posts. Default 0|false.462 * @type bool $hide_if_empty Whether to hide the drop-down if no terms exist. Default false.463 * @type string $taxonomy The taxonomy slug.464 * @type string $name Value of the name attribute to use for the drop-down select element.465 * Default 'parent'.466 * @type string $orderby The field to order by. Default 'name'.467 * @type bool $hierarchical Whether the taxonomy is hierarchical. Default true.468 * @type string $show_option_none Label to display if there are no terms. Default 'None'.469 * }470 * @param string $taxonomy The taxonomy slug.471 * @param string $context Filter context. Accepts 'new' or 'edit'.472 */473 $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' );474 475 wp_dropdown_categories( $dropdown_args );476 ?>477 <?php if ( 'category' == $taxonomy ) : ?>444 <?php 445 $dropdown_args = array( 446 'hide_empty' => 0, 447 'hide_if_empty' => false, 448 'taxonomy' => $taxonomy, 449 'name' => 'parent', 450 'orderby' => 'name', 451 'hierarchical' => true, 452 'show_option_none' => __( 'None' ), 453 ); 454 455 /** 456 * Filters the taxonomy parent drop-down on the Edit Term page. 457 * 458 * @since 3.7.0 459 * @since 4.2.0 Added `$context` parameter. 460 * 461 * @param array $dropdown_args { 462 * An array of taxonomy parent drop-down arguments. 463 * 464 * @type int|bool $hide_empty Whether to hide terms not attached to any posts. Default 0|false. 465 * @type bool $hide_if_empty Whether to hide the drop-down if no terms exist. Default false. 466 * @type string $taxonomy The taxonomy slug. 467 * @type string $name Value of the name attribute to use for the drop-down select element. 468 * Default 'parent'. 469 * @type string $orderby The field to order by. Default 'name'. 470 * @type bool $hierarchical Whether the taxonomy is hierarchical. Default true. 471 * @type string $show_option_none Label to display if there are no terms. Default 'None'. 472 * } 473 * @param string $taxonomy The taxonomy slug. 474 * @param string $context Filter context. Accepts 'new' or 'edit'. 475 */ 476 $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' ); 477 478 wp_dropdown_categories( $dropdown_args ); 479 ?> 480 <?php if ( 'category' == $taxonomy ) : ?> 478 481 <p><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p> 479 482 <?php else : ?> … … 481 484 <?php endif; ?> 482 485 </div> 483 <?php endif; // is_taxonomy_hierarchical() ?>486 <?php endif; // is_taxonomy_hierarchical() ?> 484 487 <div class="form-field term-description-wrap"> 485 488 <label for="tag-description"><?php _e( 'Description' ); ?></label> … … 488 491 </div> 489 492 490 <?php 491 if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { 493 <?php 494 if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { 495 /** 496 * Fires after the Add Tag form fields for non-hierarchical taxonomies. 497 * 498 * @since 3.0.0 499 * 500 * @param string $taxonomy The taxonomy slug. 501 */ 502 do_action( 'add_tag_form_fields', $taxonomy ); 503 } 504 492 505 /** 493 * Fires after the Add Tag form fields for non-hierarchical taxonomies. 506 * Fires after the Add Term form fields. 507 * 508 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 494 509 * 495 510 * @since 3.0.0 … … 497 512 * @param string $taxonomy The taxonomy slug. 498 513 */ 499 do_action( 'add_tag_form_fields', $taxonomy ); 500 } 501 502 /** 503 * Fires after the Add Term form fields. 504 * 505 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 506 * 507 * @since 3.0.0 508 * 509 * @param string $taxonomy The taxonomy slug. 510 */ 511 do_action( "{$taxonomy}_add_form_fields", $taxonomy ); 512 513 submit_button( $tax->labels->add_new_item ); 514 515 if ( 'category' == $taxonomy ) { 514 do_action( "{$taxonomy}_add_form_fields", $taxonomy ); 515 516 submit_button( $tax->labels->add_new_item ); 517 518 if ( 'category' == $taxonomy ) { 519 /** 520 * Fires at the end of the Edit Category form. 521 * 522 * @since 2.1.0 523 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 524 * 525 * @param object $arg Optional arguments cast to an object. 526 */ 527 do_action( 'edit_category_form', (object) array( 'parent' => 0 ) ); 528 } elseif ( 'link_category' == $taxonomy ) { 529 /** 530 * Fires at the end of the Edit Link form. 531 * 532 * @since 2.3.0 533 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 534 * 535 * @param object $arg Optional arguments cast to an object. 536 */ 537 do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) ); 538 } else { 539 /** 540 * Fires at the end of the Add Tag form. 541 * 542 * @since 2.7.0 543 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 544 * 545 * @param string $taxonomy The taxonomy slug. 546 */ 547 do_action( 'add_tag_form', $taxonomy ); 548 } 549 516 550 /** 517 * Fires at the end of the Edit Category form. 518 * 519 * @since 2.1.0 520 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 521 * 522 * @param object $arg Optional arguments cast to an object. 523 */ 524 do_action( 'edit_category_form', (object) array( 'parent' => 0 ) ); 525 } elseif ( 'link_category' == $taxonomy ) { 526 /** 527 * Fires at the end of the Edit Link form. 528 * 529 * @since 2.3.0 530 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 531 * 532 * @param object $arg Optional arguments cast to an object. 533 */ 534 do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) ); 535 } else { 536 /** 537 * Fires at the end of the Add Tag form. 538 * 539 * @since 2.7.0 540 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead. 551 * Fires at the end of the Add Term form for all taxonomies. 552 * 553 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 554 * 555 * @since 3.0.0 541 556 * 542 557 * @param string $taxonomy The taxonomy slug. 543 558 */ 544 do_action( 'add_tag_form', $taxonomy ); 545 } 546 547 /** 548 * Fires at the end of the Add Term form for all taxonomies. 549 * 550 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 551 * 552 * @since 3.0.0 553 * 554 * @param string $taxonomy The taxonomy slug. 555 */ 556 do_action( "{$taxonomy}_add_form", $taxonomy ); 557 ?> 559 do_action( "{$taxonomy}_add_form", $taxonomy ); 560 ?> 558 561 </form></div> 559 562 <?php } ?> … … 588 591 ?> 589 592 </p> 590 <?php if ( current_user_can( 'import' ) ) : ?>593 <?php if ( current_user_can( 'import' ) ) : ?> 591 594 <p><?php printf( __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ), esc_url( $import_link ) ); ?></p> 592 <?php endif; ?>595 <?php endif; ?> 593 596 </div> 594 597 <?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?> … … 596 599 <p><?php printf( __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ), esc_url( $import_link ) ); ?></p> 597 600 </div> 598 <?php601 <?php 599 602 endif; 600 603 … … 621 624 try{document.forms.addtag['tag-name'].focus();}catch(e){} 622 625 </script> 623 <?php626 <?php 624 627 endif; 625 628
Note: See TracChangeset
for help on using the changeset viewer.