Make WordPress Core

Ticket #32642: 32642.diff

File 32642.diff, 7.6 KB (added by paulwilde, 10 years ago)
  • wp-admin/edit-tag-form.php

    diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php
    index 7e2d937..338fe47 100644
    a b do_action( "{$taxonomy}_term_edit_form_tag" ); 
    8686                        <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
    8787                        <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
    8888                </tr>
    89 <?php if ( !global_terms_enabled() ) { ?>
     89<?php if ( ! global_terms_enabled() && in_array( 'slug', $tax->supports ) ) { ?>
    9090                <tr class="form-field term-slug-wrap">
    9191                        <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th>
    9292                        <?php
    do_action( "{$taxonomy}_term_edit_form_tag" ); 
    133133                        </td>
    134134                </tr>
    135135<?php endif; // is_taxonomy_hierarchical() ?>
     136<?php if ( in_array( 'description', $tax->supports ) ) { ?>
    136137                <tr class="form-field term-description-wrap">
    137138                        <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
    138139                        <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
    139140                        <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td>
    140141                </tr>
     142<?php } ?>
    141143                <?php
    142144                // Back compat hooks
    143145                if ( 'category' == $taxonomy ) {
  • wp-admin/edit-tags.php

    diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php
    index 5720b7a..1dd0b75 100644
    a b if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $t 
    217217                $help .= '<ul>' .
    218218                '<li>' . __( '<strong>Name</strong> - The name is how it appears on your site.' ) . '</li>';
    219219
    220                 if ( ! global_terms_enabled() )
     220                if ( ! global_terms_enabled() && in_array( 'slug', $tax->supports ) ) {
    221221                        $help .= '<li>' . __( '<strong>Slug</strong> - The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>';
     222                }
    222223
    223                 if ( 'category' == $taxonomy )
     224                if ( 'category' == $taxonomy ) {
    224225                        $help .= '<li>' . __( '<strong>Parent</strong> - Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>';
     226                }
     227                       
     228                if ( in_array( 'description', $tax->supports ) ) {
     229                        $help .= '<li>' . __( '<strong>Description</strong> - The description is not prominent by default; however, some themes may display it.' ) . '</li>';
     230                }
    225231
    226                 $help .= '<li>' . __( '<strong>Description</strong> - The description is not prominent by default; however, some themes may display it.' ) . '</li>' .
    227                 '</ul>' .
     232                $help .= '</ul>' .
    228233                '<p>' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '</p>';
    229234
    230235                get_current_screen()->add_help_tab( array(
    do_action( "{$taxonomy}_term_new_form_tag" ); 
    461466        <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
    462467        <p><?php _e('The name is how it appears on your site.'); ?></p>
    463468</div>
    464 <?php if ( ! global_terms_enabled() ) : ?>
     469<?php if ( ! global_terms_enabled() && in_array( 'slug', $tax->supports ) ) : ?>
    465470<div class="form-field term-slug-wrap">
    466471        <label for="tag-slug"><?php _e( 'Slug' ); ?></label>
    467472        <input name="slug" id="tag-slug" type="text" value="" size="40" />
    do_action( "{$taxonomy}_term_new_form_tag" ); 
    512517        <?php endif; ?>
    513518</div>
    514519<?php endif; // is_taxonomy_hierarchical() ?>
    515 <div class="form-field term-description-wrap">
    516         <label for="tag-description"><?php _e( 'Description' ); ?></label>
    517         <textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
    518         <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
    519 </div>
     520
     521<?php if ( in_array( 'description', $tax->supports ) ) { ?>
     522        <div class="form-field term-description-wrap">
     523                <label for="tag-description"><?php _e( 'Description' ); ?></label>
     524                <textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
     525                <p><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p>
     526        </div>
     527<?php } ?>
    520528
    521529<?php
    522530if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
  • wp-admin/includes/class-wp-terms-list-table.php

    diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php
    index c061fa6..a79155e 100644
    a b class WP_Terms_List_Table extends WP_List_Table { 
    164164         * @return array
    165165         */
    166166        public function get_columns() {
     167                $taxonomy = $this->screen->taxonomy;
     168                $tax      = get_taxonomy( $taxonomy );
     169
    167170                $columns = array(
    168171                        'cb'          => '<input type="checkbox" />',
    169172                        'name'        => _x( 'Name', 'term name' ),
    170173                        'description' => __( 'Description' ),
    171174                        'slug'        => __( 'Slug' ),
    172175                );
     176                foreach ( $columns as $key => $value ) {
     177                        if ( ! in_array( $key, $tax->supports ) && in_array( $key, [ 'slug', 'description' ] ) ) {
     178                                unset( $columns[ $key ] );     
     179                        }
     180                }
    173181
    174                 if ( 'link_category' == $this->screen->taxonomy ) {
     182                if ( 'link_category' == $taxonomy ) {
    175183                        $columns['links'] = __( 'Links' );
    176184                } else {
    177185                        $columns['posts'] = _x( 'Count', 'Number/count of items' );
    class WP_Terms_List_Table extends WP_List_Table { 
    541549                                        <span class="title"><?php _ex( 'Name', 'term name' ); ?></span>
    542550                                        <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
    543551                                </label>
    544         <?php if ( !global_terms_enabled() ) { ?>
     552                        <?php if ( ! global_terms_enabled() && in_array( 'slug', $tax->supports ) ) { ?>
    545553                                <label>
    546554                                        <span class="title"><?php _e( 'Slug' ); ?></span>
    547555                                        <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
    548556                                </label>
    549         <?php } ?>
     557                        <?php } ?>
    550558                        </div></fieldset>
    551559        <?php
    552560
  • wp-includes/taxonomy.php

    diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
    index 70c465a..e78c2eb 100644
    a b function is_taxonomy_hierarchical($taxonomy) { 
    302302 *     * If false, no meta box is shown.
    303303 * - capabilities - Array of capabilities for this taxonomy.
    304304 *     * You can see accepted values in this function.
     305 * - supports - Array of certain features that this taxonomy supports.
     306 *     * If not set, defaults to array containing 'slug' & 'description'.
    305307 * - rewrite - Triggers the handling of rewrites for this taxonomy. Defaults to true, using $taxonomy as slug.
    306308 *     * To prevent rewrite, set to false.
    307309 *     * To specify rewrite rules, an array can be passed with any of these keys
    function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 
    351353                'show_admin_column'     => false,
    352354                'meta_box_cb'           => null,
    353355                'capabilities'          => array(),
     356                'supports'              => array( 'slug', 'description' ),
    354357                'rewrite'               => true,
    355358                'query_var'             => $taxonomy,
    356359                'update_count_callback' => '',
  • wp-includes/taxonomy.php

    diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
    index e78c2eb..26ec473 100644
    a b function create_initial_taxonomies() { 
    6363                'show_ui' => true,
    6464                'show_admin_column' => true,
    6565                '_builtin' => true,
     66                'supports' => array(),
    6667        ) );
    6768
    6869        register_taxonomy( 'post_tag', 'post', array(