341 | | <?php if ( $message ) : ?> |
342 | | <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div> |
343 | | <?php |
344 | | $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); |
345 | | endif; |
346 | | ?> |
347 | | <div id="ajax-response"></div> |
| 341 | <?php if ( $message ) : ?> |
| 342 | <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div> |
| 343 | <?php |
| 344 | $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); |
| 345 | endif; |
| 346 | ?> |
| 347 | <div id="ajax-response"></div> |
364 | | if ( current_user_can( $tax->cap->edit_terms ) ) { |
365 | | if ( 'category' == $taxonomy ) { |
366 | | /** |
367 | | * Fires before the Add Category form. |
368 | | * |
369 | | * @since 2.1.0 |
370 | | * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. |
371 | | * |
372 | | * @param object $arg Optional arguments cast to an object. |
373 | | */ |
374 | | do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) ); |
375 | | } elseif ( 'link_category' == $taxonomy ) { |
376 | | /** |
377 | | * Fires before the link category form. |
378 | | * |
379 | | * @since 2.3.0 |
380 | | * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. |
381 | | * |
382 | | * @param object $arg Optional arguments cast to an object. |
383 | | */ |
384 | | do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) ); |
385 | | } else { |
386 | | /** |
387 | | * Fires before the Add Tag form. |
388 | | * |
389 | | * @since 2.5.0 |
390 | | * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. |
391 | | * |
392 | | * @param string $taxonomy The taxonomy slug. |
393 | | */ |
394 | | do_action( 'add_tag_form_pre', $taxonomy ); |
395 | | } |
| 364 | if ( current_user_can( $tax->cap->edit_terms ) ) { |
| 365 | if ( 'category' == $taxonomy ) { |
| 366 | /** |
| 367 | * Fires before the Add Category form. |
| 368 | * |
| 369 | * @since 2.1.0 |
| 370 | * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. |
| 371 | * |
| 372 | * @param object $arg Optional arguments cast to an object. |
| 373 | */ |
| 374 | do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) ); |
| 375 | } elseif ( 'link_category' == $taxonomy ) { |
| 376 | /** |
| 377 | * Fires before the link category form. |
| 378 | * |
| 379 | * @since 2.3.0 |
| 380 | * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. |
| 381 | * |
| 382 | * @param object $arg Optional arguments cast to an object. |
| 383 | */ |
| 384 | do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) ); |
| 385 | } else { |
| 386 | /** |
| 387 | * Fires before the Add Tag form. |
| 388 | * |
| 389 | * @since 2.5.0 |
| 390 | * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. |
| 391 | * |
| 392 | * @param string $taxonomy The taxonomy slug. |
| 393 | */ |
| 394 | do_action( 'add_tag_form_pre', $taxonomy ); |
| 395 | } |
397 | | /** |
398 | | * Fires before the Add Term form for all taxonomies. |
399 | | * |
400 | | * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
401 | | * |
402 | | * @since 3.0.0 |
403 | | * |
404 | | * @param string $taxonomy The taxonomy slug. |
405 | | */ |
406 | | do_action( "{$taxonomy}_pre_add_form", $taxonomy ); |
407 | | ?> |
| 397 | /** |
| 398 | * Fires before the Add Term form for all taxonomies. |
| 399 | * |
| 400 | * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
| 401 | * |
| 402 | * @since 3.0.0 |
| 403 | * |
| 404 | * @param string $taxonomy The taxonomy slug. |
| 405 | */ |
| 406 | do_action( "{$taxonomy}_pre_add_form", $taxonomy ); |
| 407 | ?> |
409 | | <div class="form-wrap"> |
410 | | <h2><?php echo $tax->labels->add_new_item; ?></h2> |
411 | | <form id="addtag" method="post" action="edit-tags.php" class="validate" |
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 | | ?> |
422 | | > |
423 | | <input type="hidden" name="action" value="add-tag" /> |
424 | | <input type="hidden" name="screen" value="<?php echo esc_attr( $current_screen->id ); ?>" /> |
425 | | <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" /> |
426 | | <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" /> |
427 | | <?php wp_nonce_field( 'add-tag', '_wpnonce_add-tag' ); ?> |
| 409 | <div class="form-wrap"> |
| 410 | <h2><?php echo $tax->labels->add_new_item; ?></h2> |
| 411 | <form id="addtag" method="post" action="edit-tags.php" class="validate" |
| 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 | ?> |
| 422 | > |
| 423 | <input type="hidden" name="action" value="add-tag" /> |
| 424 | <input type="hidden" name="screen" value="<?php echo esc_attr( $current_screen->id ); ?>" /> |
| 425 | <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" /> |
| 426 | <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" /> |
| 427 | <?php wp_nonce_field( 'add-tag', '_wpnonce_add-tag' ); ?> |
429 | | <div class="form-field form-required term-name-wrap"> |
430 | | <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label> |
431 | | <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" /> |
432 | | <p><?php _e( 'The name is how it appears on your site.' ); ?></p> |
433 | | </div> |
434 | | <?php if ( ! global_terms_enabled() ) : ?> |
435 | | <div class="form-field term-slug-wrap"> |
436 | | <label for="tag-slug"><?php _e( 'Slug' ); ?></label> |
437 | | <input name="slug" id="tag-slug" type="text" value="" size="40" /> |
438 | | <p><?php _e( 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ); ?></p> |
439 | | </div> |
440 | | <?php endif; // global_terms_enabled() ?> |
441 | | <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> |
442 | | <div class="form-field term-parent-wrap"> |
443 | | <label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label> |
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 | | ); |
| 429 | <div class="form-field form-required term-name-wrap"> |
| 430 | <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label> |
| 431 | <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" /> |
| 432 | <p><?php _e( 'The name is how it appears on your site.' ); ?></p> |
| 433 | </div> |
| 434 | <?php if ( ! global_terms_enabled() ) : ?> |
| 435 | <div class="form-field term-slug-wrap"> |
| 436 | <label for="tag-slug"><?php _e( 'Slug' ); ?></label> |
| 437 | <input name="slug" id="tag-slug" type="text" value="" size="40" /> |
| 438 | <p><?php _e( 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ); ?></p> |
| 439 | </div> |
| 440 | <?php endif; // global_terms_enabled() ?> |
| 441 | <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> |
| 442 | <div class="form-field term-parent-wrap"> |
| 443 | <label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label> |
| 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 | ); |
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' ); |
| 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' ); |
478 | | wp_dropdown_categories( $dropdown_args ); |
479 | | ?> |
480 | | <?php if ( 'category' == $taxonomy ) : ?> |
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> |
482 | | <?php else : ?> |
483 | | <p><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); ?></p> |
484 | | <?php endif; ?> |
485 | | </div> |
486 | | <?php endif; // is_taxonomy_hierarchical() ?> |
487 | | <div class="form-field term-description-wrap"> |
488 | | <label for="tag-description"><?php _e( 'Description' ); ?></label> |
489 | | <textarea name="description" id="tag-description" rows="5" cols="40"></textarea> |
490 | | <p><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p> |
491 | | </div> |
| 478 | wp_dropdown_categories( $dropdown_args ); |
| 479 | ?> |
| 480 | <?php if ( 'category' == $taxonomy ) : ?> |
| 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> |
| 482 | <?php else : ?> |
| 483 | <p><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); ?></p> |
| 484 | <?php endif; ?> |
| 485 | </div> |
| 486 | <?php endif; // is_taxonomy_hierarchical() ?> |
| 487 | <div class="form-field term-description-wrap"> |
| 488 | <label for="tag-description"><?php _e( 'Description' ); ?></label> |
| 489 | <textarea name="description" id="tag-description" rows="5" cols="40"></textarea> |
| 490 | <p><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p> |
| 491 | </div> |
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 | | } |
| 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 | } |
505 | | /** |
506 | | * Fires after the Add Term form fields. |
507 | | * |
508 | | * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
509 | | * |
510 | | * @since 3.0.0 |
511 | | * |
512 | | * @param string $taxonomy The taxonomy slug. |
513 | | */ |
514 | | do_action( "{$taxonomy}_add_form_fields", $taxonomy ); |
| 505 | /** |
| 506 | * Fires after the Add Term form fields. |
| 507 | * |
| 508 | * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
| 509 | * |
| 510 | * @since 3.0.0 |
| 511 | * |
| 512 | * @param string $taxonomy The taxonomy slug. |
| 513 | */ |
| 514 | do_action( "{$taxonomy}_add_form_fields", $taxonomy ); |
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 | | } |
| 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 | } |
550 | | /** |
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 |
556 | | * |
557 | | * @param string $taxonomy The taxonomy slug. |
558 | | */ |
559 | | do_action( "{$taxonomy}_add_form", $taxonomy ); |
560 | | ?> |
561 | | </form></div> |
562 | | <?php } ?> |
| 550 | /** |
| 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 |
| 556 | * |
| 557 | * @param string $taxonomy The taxonomy slug. |
| 558 | */ |
| 559 | do_action( "{$taxonomy}_add_form", $taxonomy ); |
| 560 | ?> |
| 561 | </form> |
| 562 | </div> |
| 563 | <?php } ?> |
580 | | <?php if ( 'category' == $taxonomy ) : ?> |
581 | | <div class="form-wrap edit-term-notes"> |
582 | | <p> |
583 | | <?php |
584 | | echo '<strong>' . __( 'Note:' ) . '</strong><br />'; |
585 | | printf( |
586 | | /* translators: %s: default category */ |
587 | | __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.' ), |
588 | | /** This filter is documented in wp-includes/category-template.php */ |
589 | | '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category' ) ), '', '' ) . '</strong>' |
590 | | ); |
591 | | ?> |
592 | | </p> |
593 | | <?php if ( current_user_can( 'import' ) ) : ?> |
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> |
595 | | <?php endif; ?> |
596 | | </div> |
597 | | <?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?> |
598 | | <div class="form-wrap edit-term-notes"> |
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> |
600 | | </div> |
601 | | <?php |
602 | | endif; |
| 581 | <?php if ( 'category' == $taxonomy ) : ?> |
| 582 | <div class="form-wrap edit-term-notes"> |
| 583 | <p> |
| 584 | <?php |
| 585 | echo '<strong>' . __( 'Note:' ) . '</strong><br />'; |
| 586 | printf( |
| 587 | /* translators: %s: default category */ |
| 588 | __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.' ), |
| 589 | /** This filter is documented in wp-includes/category-template.php */ |
| 590 | '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category' ) ), '', '' ) . '</strong>' |
| 591 | ); |
| 592 | ?> |
| 593 | </p> |
| 594 | <?php if ( current_user_can( 'import' ) ) : ?> |
| 595 | <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> |
| 596 | <?php endif; ?> |
| 597 | </div> |
| 598 | <?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?> |
| 599 | <div class="form-wrap edit-term-notes"> |
| 600 | <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> |
| 601 | </div> |
| 602 | <?php |
| 603 | endif; |
| 604 | /** |
| 605 | * Fires after the taxonomy list table. |
| 606 | * |
| 607 | * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
| 608 | * |
| 609 | * @since 3.0.0 |
| 610 | * |
| 611 | * @param string $taxonomy The taxonomy name. |
| 612 | */ |
| 613 | do_action( "after-{$taxonomy}-table", $taxonomy ); |
| 614 | ?> |