From 00da2f2c6ad626ea08b7f1408bf83d10235c07d9 Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <ivanov.bg@gmail.com>
Date: Mon, 10 Sep 2018 00:25:17 +0300
Subject: [PATCH] Added new labels for descriptions of the edit form fields
---
wp-admin/edit-tag-form.php | 8 ++++----
wp-admin/edit-tags.php | 8 ++++----
wp-includes/taxonomy.php | 6 +++++-
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git wp-admin/edit-tag-form.php wp-admin/edit-tag-form.php
index d9658bb..07fbbcb 100644
|
|
if ( isset( $tag->name ) ) { |
127 | 127 | <tr class="form-field form-required term-name-wrap"> |
128 | 128 | <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> |
129 | 129 | <td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" /> |
130 | | <p class="description"><?php _e( 'The name is how it appears on your site.' ); ?></p></td> |
| 130 | <p class="description"><?php echo esc_html( $tax->labels->name_description ); ?></p></td> |
131 | 131 | </tr> |
132 | 132 | <?php if ( ! global_terms_enabled() ) { ?> |
133 | 133 | <tr class="form-field term-slug-wrap"> |
… |
… |
if ( isset( $tag->name ) ) { |
149 | 149 | $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : ''; |
150 | 150 | ?> |
151 | 151 | <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" /> |
152 | | <p class="description"><?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></td> |
| 152 | <p class="description"><?php echo esc_html( $tax->labels->slug_description ); ?></p></td> |
153 | 153 | </tr> |
154 | 154 | <?php } ?> |
155 | 155 | <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> |
… |
… |
if ( isset( $tag->name ) ) { |
176 | 176 | <?php if ( 'category' == $taxonomy ) : ?> |
177 | 177 | <p class="description"><?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> |
178 | 178 | <?php else : ?> |
179 | | <p class="description"><?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> |
| 179 | <p class="description"><?php echo esc_html( $tax->labels->parent_description ); ?></p> |
180 | 180 | <?php endif; ?> |
181 | 181 | </td> |
182 | 182 | </tr> |
… |
… |
if ( isset( $tag->name ) ) { |
184 | 184 | <tr class="form-field term-description-wrap"> |
185 | 185 | <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th> |
186 | 186 | <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea> |
187 | | <p class="description"><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p></td> |
| 187 | <p class="description"><?php echo esc_html( $tax->labels->description_description ); ?></p></td> |
188 | 188 | </tr> |
189 | 189 | <?php |
190 | 190 | // Back compat hooks |
diff --git wp-admin/edit-tags.php wp-admin/edit-tags.php
index b0827af..134d9d6 100644
|
|
if ( current_user_can( $tax->cap->edit_terms ) ) { |
429 | 429 | <div class="form-field form-required term-name-wrap"> |
430 | 430 | <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label> |
431 | 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> |
| 432 | <p><?php echo esc_html( $tax->labels->name_description ); ?></p> |
433 | 433 | </div> |
434 | 434 | <?php if ( ! global_terms_enabled() ) : ?> |
435 | 435 | <div class="form-field term-slug-wrap"> |
436 | 436 | <label for="tag-slug"><?php _e( 'Slug' ); ?></label> |
437 | 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> |
| 438 | <p><?php echo esc_html( $tax->labels->slug_description ); ?></p> |
439 | 439 | </div> |
440 | 440 | <?php endif; // global_terms_enabled() ?> |
441 | 441 | <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> |
… |
… |
if ( current_user_can( $tax->cap->edit_terms ) ) { |
480 | 480 | <?php if ( 'category' == $taxonomy ) : ?> |
481 | 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 | 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> |
| 483 | <p><?php echo esc_html( $tax->labels->parent_description ); ?></p> |
484 | 484 | <?php endif; ?> |
485 | 485 | </div> |
486 | 486 | <?php endif; // is_taxonomy_hierarchical() ?> |
487 | 487 | <div class="form-field term-description-wrap"> |
488 | 488 | <label for="tag-description"><?php _e( 'Description' ); ?></label> |
489 | 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> |
| 490 | <p><?php echo esc_html( $tax->labels->description_description ); ?></p> |
491 | 491 | </div> |
492 | 492 | |
493 | 493 | <?php |
diff --git wp-includes/taxonomy.php wp-includes/taxonomy.php
index 7a27832..a403342 100644
|
|
function get_taxonomy_labels( $tax ) { |
545 | 545 | |
546 | 546 | $nohier_vs_hier_defaults = array( |
547 | 547 | 'name' => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ), |
| 548 | 'name_description' => array( __( 'The name is how it appears on your site.' ), __( 'The name is how it appears on your site.' ) ), |
548 | 549 | 'singular_name' => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ), |
549 | 550 | 'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ), |
550 | 551 | 'popular_items' => array( __( 'Popular Tags' ), null ), |
551 | 552 | 'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ), |
552 | 553 | 'parent_item' => array( null, __( 'Parent Category' ) ), |
553 | 554 | 'parent_item_colon' => array( null, __( 'Parent Category:' ) ), |
| 555 | 'parent_description' => array( null, __( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ) ), |
| 556 | 'slug_description' => array( __( 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ), __( 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' )), |
| 557 | 'description_description' => array( __( 'The description is not prominent by default; however, some themes may show it.' ), __( 'The description is not prominent by default; however, some themes may show it.' )), |
554 | 558 | 'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ), |
555 | 559 | 'view_item' => array( __( 'View Tag' ), __( 'View Category' ) ), |
556 | 560 | 'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ), |
… |
… |
function get_taxonomy_labels( $tax ) { |
565 | 569 | 'items_list' => array( __( 'Tags list' ), __( 'Categories list' ) ), |
566 | 570 | /* translators: Tab heading when selecting from the most used terms */ |
567 | 571 | 'most_used' => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ), |
568 | | 'back_to_items' => array( __( '← Back to Tags' ), __( '← Back to Categories' ) ), |
| 572 | 'back_to_items' => array( __( '← Back to Tags' ), __( '← Back to Categories' ) ) |
569 | 573 | ); |
570 | 574 | $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; |
571 | 575 | |