Taxonomy: Change some static strings to registration labels.

Add additional label options to `register_taxonomy()` to allow developers further flexibility for customizing the edit taxonomy screen.

Props mclaurent, swissspidy, johnbillion, jeremyescott, theMikeD, jeremyfelt, dontgo2sleep, SergeyBiryukov, audrasjb, Boniu91.
Fixes #43060.


Built from https://develop.svn.wordpress.org/trunk@52094


git-svn-id: http://core.svn.wordpress.org/trunk@51686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson
2021-11-10 00:46:00 +00:00
parent 1dac2cdae7
commit 37c02eb5fe
4 changed files with 13 additions and 9 deletions

View File

@@ -146,7 +146,7 @@ if ( isset( $tag->name ) ) {
<tr class="form-field form-required term-name-wrap">
<th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
<td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" />
<p class="description"><?php _e( 'The name is how it appears on your site.' ); ?></p></td>
<p class="description"><?php echo $tax->labels->name_description; ?></p></td>
</tr>
<?php if ( ! global_terms_enabled() ) { ?>
<tr class="form-field term-slug-wrap">
@@ -168,7 +168,7 @@ if ( isset( $tag->name ) ) {
$slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
?>
<td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
<p class="description"><?php _e( 'The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ); ?></p></td>
<p class="description"><?php echo $tax->labels->slug_description; ?></p></td>
</tr>
<?php } ?>
<?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?>
@@ -195,7 +195,7 @@ if ( isset( $tag->name ) ) {
<?php if ( 'category' === $taxonomy ) : ?>
<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>
<?php else : ?>
<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>
<p class="description"><?php echo $tax->labels->parent_description; ?></p>
<?php endif; ?>
</td>
</tr>
@@ -203,7 +203,7 @@ if ( isset( $tag->name ) ) {
<tr class="form-field term-description-wrap">
<th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
<td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
<p class="description"><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p></td>
<p class="description"><?php echo $tax->labels->description_description; ?></p></td>
</tr>
<?php
// Back compat hooks.

View File

@@ -454,13 +454,13 @@ if ( $can_edit_terms ) {
<div class="form-field form-required term-name-wrap">
<label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
<input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
<p><?php _e( 'The name is how it appears on your site.' ); ?></p>
<p><?php echo $tax->labels->name_description; ?></p>
</div>
<?php if ( ! global_terms_enabled() ) : ?>
<div class="form-field term-slug-wrap">
<label for="tag-slug"><?php _e( 'Slug' ); ?></label>
<input name="slug" id="tag-slug" type="text" value="" size="40" />
<p><?php _e( 'The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ); ?></p>
<p><?php echo $tax->labels->slug_description; ?></p>
</div>
<?php endif; // global_terms_enabled() ?>
<?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?>
@@ -505,14 +505,14 @@ if ( $can_edit_terms ) {
<?php if ( 'category' === $taxonomy ) : ?>
<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>
<?php else : ?>
<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>
<p><?php echo $tax->labels->parent_description; ?></p>
<?php endif; ?>
</div>
<?php endif; // is_taxonomy_hierarchical() ?>
<div class="form-field term-description-wrap">
<label for="tag-description"><?php _e( 'Description' ); ?></label>
<textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
<p><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p>
<p><?php echo $tax->labels->description_description; ?></p>
</div>
<?php