WordPress.org

Make WordPress Core

Ticket #43060: 43060.diff

File 43060.diff, 7.7 KB (added by dontgo2sleep, 2 years ago)
  • wp-admin/edit-tag-form.php

    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 ) ) { 
    127127                <tr class="form-field form-required term-name-wrap">
    128128                        <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
    129129                        <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>
    131131                </tr>
    132132<?php if ( ! global_terms_enabled() ) { ?>
    133133                <tr class="form-field term-slug-wrap">
    if ( isset( $tag->name ) ) { 
    149149                        $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
    150150                        ?>
    151151                        <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
    152                         <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>
     152                        <p class="description"><?php echo esc_html( $tax->labels->slug_description ); ?></p></td>
    153153                </tr>
    154154<?php } ?>
    155155<?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?>
    if ( isset( $tag->name ) ) { 
    176176                                <?php if ( 'category' == $taxonomy ) : ?>
    177177                                        <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>
    178178                                <?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>
    180180                                <?php endif; ?>
    181181                        </td>
    182182                </tr>
    if ( isset( $tag->name ) ) { 
    184184                <tr class="form-field term-description-wrap">
    185185                        <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
    186186                        <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>
    188188                </tr>
    189189                <?php
    190190                // Back compat hooks
  • wp-admin/edit-tags.php

    diff --git wp-admin/edit-tags.php wp-admin/edit-tags.php
    index b0827af..134d9d6 100644
    if ( current_user_can( $tax->cap->edit_terms ) ) { 
    429429<div class="form-field form-required term-name-wrap">
    430430        <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
    431431        <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>
    433433</div>
    434434        <?php if ( ! global_terms_enabled() ) : ?>
    435435<div class="form-field term-slug-wrap">
    436436        <label for="tag-slug"><?php _e( 'Slug' ); ?></label>
    437437        <input name="slug" id="tag-slug" type="text" value="" size="40" />
    438         <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>
     438        <p><?php echo esc_html( $tax->labels->slug_description ); ?></p>
    439439</div>
    440440<?php endif; // global_terms_enabled() ?>
    441441        <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?>
    if ( current_user_can( $tax->cap->edit_terms ) ) { 
    480480                <?php if ( 'category' == $taxonomy ) : ?>
    481481                <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>
    482482        <?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>
    484484        <?php endif; ?>
    485485</div>
    486486        <?php endif; // is_taxonomy_hierarchical() ?>
    487487<div class="form-field term-description-wrap">
    488488        <label for="tag-description"><?php _e( 'Description' ); ?></label>
    489489        <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>
    491491</div>
    492492
    493493        <?php
  • wp-includes/taxonomy.php

    diff --git wp-includes/taxonomy.php wp-includes/taxonomy.php
    index 7a27832..a403342 100644
    function get_taxonomy_labels( $tax ) { 
    545545
    546546        $nohier_vs_hier_defaults = array(
    547547                '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.' ) ),
    548549                'singular_name'              => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ),
    549550                'search_items'               => array( __( 'Search Tags' ), __( 'Search Categories' ) ),
    550551                'popular_items'              => array( __( 'Popular Tags' ), null ),
    551552                'all_items'                  => array( __( 'All Tags' ), __( 'All Categories' ) ),
    552553                'parent_item'                => array( null, __( 'Parent Category' ) ),
    553554                '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 &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ), __( 'The &#8220;slug&#8221; 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.' )),
    554558                'edit_item'                  => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),
    555559                'view_item'                  => array( __( 'View Tag' ), __( 'View Category' ) ),
    556560                'update_item'                => array( __( 'Update Tag' ), __( 'Update Category' ) ),
    function get_taxonomy_labels( $tax ) { 
    565569                'items_list'                 => array( __( 'Tags list' ), __( 'Categories list' ) ),
    566570                /* translators: Tab heading when selecting from the most used terms */
    567571                'most_used'                  => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ),
    568                 'back_to_items'              => array( __( '&larr; Back to Tags' ), __( '&larr; Back to Categories' ) ),
     572                'back_to_items'              => array( __( '&larr; Back to Tags' ), __( '&larr; Back to Categories' ) )
    569573        );
    570574        $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
    571575