Make WordPress Core

Ticket #10122: 10122-2.patch

File 10122-2.patch, 28.6 KB (added by prettyboymp, 15 years ago)

Fixed typo causing checked parent categories to return unchecked after addition of sub-category

  • wp-includes/taxonomy.php

     
    194194        $args['name'] = $taxonomy;
    195195        $args['object_type'] = (array) $object_type;
    196196        $wp_taxonomies[$taxonomy] = (object) $args;
     197       
     198        //register callback handling for metabox
     199        add_filter('wp_ajax_add-'.$taxonomy, '_wp_ajax_add_hierarchical_term'); 
    197200}
    198201
    199202/**
     
    15731576 * slug has to be globally unique for every taxonomy.
    15741577 *
    15751578 * The way this works is that if the taxonomy that the term belongs to is
    1576  * heirarchical and has a parent, it will append that parent to the $slug.
     1579 * hierarchical and has a parent, it will append that parent to the $slug.
    15771580 *
    15781581 * If that still doesn't return an unique slug, then it try to append a number
    15791582 * until it finds a number that is truely unique.
  • wp-includes/category-template.php

     
    356356        if ( (int) $tab_index > 0 )
    357357                $tab_index_attribute = " tabindex=\"$tab_index\"";
    358358
    359         $categories = get_categories( $r );
     359        $categories = get_terms( $taxonomy, $r );
    360360        $name = esc_attr($name);
    361361        $class = esc_attr($class);
    362362
  • wp-admin/admin-ajax.php

     
    200200        $x->send();
    201201}
    202202
     203function _wp_ajax_add_hierarchical_term() {
     204        $action = $_POST['action'];
     205        $taxonomy = get_taxonomy(substr($action, 4));
     206        check_ajax_referer( $action );
     207        if ( !current_user_can( 'manage_categories' ) )
     208                die('-1');
     209        $names = explode(',', $_POST['new'.$taxonomy->name]);
     210        if ( 0 > $parent = (int) $_POST['new'.$taxonomy->name.'_parent'] )
     211                $parent = 0;
     212        if($taxonomy->name == 'category') {
     213                $post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
     214        }
     215        else {
     216                $post_category = (isset($_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name])) ? (array) $_POST['tax_input'][$taxonomy->name] : array();
     217        }
     218        $checked_categories = array_map( 'absint', (array) $post_category );
     219        $popular_ids = wp_popular_terms_checklist($taxonomy->name, 0, 10, false);
     220
     221        foreach ( $names as $cat_name ) {
     222                $cat_name = trim($cat_name);
     223                $category_nicename = sanitize_title($cat_name);
     224                if ( '' === $category_nicename )
     225                        continue;
     226                if(!($cat_id = is_term($cat_name, $taxonomy->name, $parent))) {
     227                        $new_term = wp_insert_term($cat_name, $taxonomy->name, array('parent' => $parent));
     228                        $cat_id = $new_term['term_id'];
     229                }
     230                $checked_categories[] = $cat_id;
     231                if ( $parent ) // Do these all at once in a second
     232                        continue;
     233                $category = get_term( $cat_id, $taxonomy->name );
     234                ob_start();
     235                        wp_terms_checklist( 0, array('taxonomy'=>$taxonomy->name, 'descendants_and_self'=>$cat_id, 'selected_cats'=>$checked_categories, 'popular_cats'=>$popular_ids));
     236                $data = ob_get_contents();
     237                ob_end_clean();
     238                $add = array(
     239                        'what' => $taxonomy->name,
     240                        'id' => $cat_id,
     241                        'data' => str_replace( array("\n", "\t"), '', $data),
     242                        'position' => -1
     243                );
     244        }
     245        if ( $parent ) { // Foncy - replace the parent and all its children
     246                $parent = get_term( $parent, $taxonomy->name );
     247                $term_id = $parent->term_id;
     248
     249                while ( $parent->parent ) { // get the top parent
     250                        $parent = &get_term( $parent->parent, $taxonomy->name );
     251                        if ( is_wp_error( $parent ) )
     252                                break;
     253                        $term_id = $parent->term_id;
     254                }
     255
     256                ob_start();
     257                        wp_terms_checklist( 0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids));
     258                $data = ob_get_contents();
     259                ob_end_clean();
     260                $add = array(
     261                        'what' => $taxonomy->name,
     262                        'id' => $term_id,
     263                        'data' => str_replace( array("\n", "\t"), '', $data),
     264                        'position' => -1
     265                );
     266        }
     267
     268        ob_start();
     269                wp_dropdown_categories( array( 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) );
     270        $sup = ob_get_contents();
     271        ob_end_clean();
     272        $add['supplemental'] = array( 'newcat_parent' => $sup );
     273
     274        $x = new WP_Ajax_Response( $add );
     275        $x->send();
     276}
     277
     278
    203279$id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    204280switch ( $action = $_POST['action'] ) :
    205281case 'delete-comment' : // On success, die with time() instead of 1
     
    409485        _wp_ajax_delete_comment_response( $comment->comment_ID );
    410486        die( '0' );
    411487        break;
    412 case 'add-category' : // On the Fly
    413         check_ajax_referer( $action );
    414         if ( !current_user_can( 'manage_categories' ) )
    415                 die('-1');
    416         $names = explode(',', $_POST['newcat']);
    417         if ( 0 > $parent = (int) $_POST['newcat_parent'] )
    418                 $parent = 0;
    419         $post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
    420         $checked_categories = array_map( 'absint', (array) $post_category );
    421         $popular_ids = wp_popular_terms_checklist('category', 0, 10, false);
    422 
    423         foreach ( $names as $cat_name ) {
    424                 $cat_name = trim($cat_name);
    425                 $category_nicename = sanitize_title($cat_name);
    426                 if ( '' === $category_nicename )
    427                         continue;
    428                 $cat_id = wp_create_category( $cat_name, $parent );
    429                 $checked_categories[] = $cat_id;
    430                 if ( $parent ) // Do these all at once in a second
    431                         continue;
    432                 $category = get_category( $cat_id );
    433                 ob_start();
    434                         wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );
    435                 $data = ob_get_contents();
    436                 ob_end_clean();
    437                 $add = array(
    438                         'what' => 'category',
    439                         'id' => $cat_id,
    440                         'data' => str_replace( array("\n", "\t"), '', $data),
    441                         'position' => -1
    442                 );
    443         }
    444         if ( $parent ) { // Foncy - replace the parent and all its children
    445                 $parent = get_category( $parent );
    446                 $term_id = $parent->term_id;
    447 
    448                 while ( $parent->parent ) { // get the top parent
    449                         $parent = &get_category( $parent->parent );
    450                         if ( is_wp_error( $parent ) )
    451                                 break;
    452                         $term_id = $parent->term_id;
    453                 }
    454 
    455                 ob_start();
    456                         wp_category_checklist( 0, $term_id, $checked_categories, $popular_ids, null, false );
    457                 $data = ob_get_contents();
    458                 ob_end_clean();
    459                 $add = array(
    460                         'what' => 'category',
    461                         'id' => $term_id,
    462                         'data' => str_replace( array("\n", "\t"), '', $data),
    463                         'position' => -1
    464                 );
    465         }
    466 
    467         ob_start();
    468                 wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) );
    469         $sup = ob_get_contents();
    470         ob_end_clean();
    471         $add['supplemental'] = array( 'newcat_parent' => $sup );
    472 
    473         $x = new WP_Ajax_Response( $add );
    474         $x->send();
    475         break;
    476488case 'add-link-category' : // On the Fly
    477489        check_ajax_referer( $action );
    478490        if ( !current_user_can( 'manage_categories' ) )
  • wp-admin/includes/meta-boxes.php

     
    268268 *
    269269 * @param object $post
    270270 */
    271 function post_categories_meta_box($post) {
    272 ?>
    273 <ul id="category-tabs">
    274         <li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
    275         <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
    276 </ul>
     271function post_categories_meta_box($post, $box) {
     272        $defaults = array('taxonomy' => 'category');
     273        if(!isset($box['args']) || !is_array($args = $box['args'])) {
     274                $args = array();
     275        }
     276        extract(array_merge($defaults, $args));
     277        ?>
     278        <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
     279                <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
     280                        <li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
     281                        <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
     282                </ul>
    277283
    278 <div id="categories-pop" class="tabs-panel" style="display: none;">
    279         <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
    280 <?php $popular_ids = wp_popular_terms_checklist('category'); ?>
    281         </ul>
    282 </div>
     284                <div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;">
     285                        <ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" >
     286                                <?php $popular_ids = wp_popular_terms_checklist($taxonomy); ?>aaa
     287                        </ul>
     288                </div>
    283289
    284 <div id="categories-all" class="tabs-panel">
    285         <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
    286 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
    287         </ul>
    288 </div>
     290                <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">
     291                        <ul id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy?> categorychecklist form-no-clear">
     292                                <?php wp_terms_checklist($post->ID, array('taxonomy'=>$taxonomy, 'popular_cats'=> $popular_ids)) ?>
     293                        </ul>
     294                </div>
    289295
    290 <?php if ( current_user_can('manage_categories') ) : ?>
    291 <div id="category-adder" class="wp-hidden-children">
    292         <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
    293         <p id="category-add" class="wp-hidden-child">
    294         <label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
    295         <label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?>
    296         <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
    297 <?php   wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
    298         <span id="category-ajax-response"></span></p>
    299 </div>
    300 <?php
    301 endif;
    302 
     296    <?php if ( current_user_can('manage_categories') ) : ?>
     297                        <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
     298                                <h4><a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
     299                                <p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child">
     300                                        <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php _e( 'Add New Category' ); ?></label><input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
     301                                        <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
     302                                        <input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-sumbit" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
     303                                        <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce', false ); ?>
     304                                        <span id="<?php echo $taxonomy; ?>-ajax-response"></span>
     305                                </p>
     306                        </div>
     307                <?php endif; ?>
     308        </div>
     309        <?php
    303310}
    304311
    305312
  • wp-admin/includes/template.php

     
    465465
    466466        function start_el(&$output, $category, $depth, $args) {
    467467                extract($args);
    468 
     468                if(empty($taxonomy))
     469                        $taxonomy = 'category';
     470               
     471                if($taxonomy == 'category')
     472                        $name = 'post_category';
     473                else
     474                        $name = 'tax_input['.$taxonomy.']';
     475                       
    469476                $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
    470                 $output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
     477                $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
    471478        }
    472479
    473480        function end_el(&$output, $category, $depth, $args) {
     
    486493 * @param unknown_type $popular_cats
    487494 */
    488495function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
     496        wp_terms_checklist($post_id,
     497                array(
     498                        'taxonomy' => 'category',
     499                        'descendants_and_self' => $descendants_and_self,
     500                        'selected_cats' => $selected_cats,
     501                        'popular_cats' => $popular_cats,
     502                        'walker' => $walker
     503  ));
     504 }
     505                 
     506/**
     507 * Taxonomy independent version of wp_category_checklist
     508 *
     509 * @param int $post_id
     510 * @param array $args
     511 */
     512function wp_terms_checklist($post_id = 0, $args = array()) {
     513        $defaults = array(
     514                'descendants_and_self' => 0,
     515    'selected_cats' => false,
     516    'popular_cats' => false,
     517    'walker' => null,
     518    'taxonomy' => 'category'
     519        );
     520        extract(array_merge($defaults, $args));
     521                       
    489522        if ( empty($walker) || !is_a($walker, 'Walker') )
    490523                $walker = new Walker_Category_Checklist;
    491524
    492525        $descendants_and_self = (int) $descendants_and_self;
    493526
    494         $args = array();
     527        $args = array('taxonomy' => $taxonomy);
    495528
    496529        if ( is_array( $selected_cats ) )
    497530                $args['selected_cats'] = $selected_cats;
    498531        elseif ( $post_id )
    499                 $args['selected_cats'] = wp_get_post_categories($post_id);
     532                $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
    500533        else
    501534                $args['selected_cats'] = array();
    502535
    503536        if ( is_array( $popular_cats ) )
    504537                $args['popular_cats'] = $popular_cats;
    505538        else
    506                 $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
     539                $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
    507540
    508541        if ( $descendants_and_self ) {
    509                 $categories = get_categories(array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0));
    510                 $self = get_category( $descendants_and_self );
     542                $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) );
     543                $self = get_term( $descendants_and_self, $taxonomy );
    511544                array_unshift( $categories, $self );
    512545        } else {
    513                 $categories = get_categories(array('get' => 'all'));
     546                $categories = (array) get_terms($taxonomy, array('get' => 'all'));
    514547        }
    515548
    516549        if ( $checked_ontop ) {
     
    547580        global $post_ID;
    548581
    549582        if ( $post_ID )
    550                 $checked_categories = wp_get_post_categories($post_ID);
     583                $checked_categories = wp_get_object_terms($post_ID, 'category', array('fields'=>'ids'));
    551584        else
    552585                $checked_categories = array();
    553586
     
    558591                $popular_ids[] = $category->term_id;
    559592                if ( !$echo ) // hack for AJAX use
    560593                        continue;
    561                 $id = "popular-category-$category->term_id";
     594                $id = "popular-$taxonomy-$category->term_id";
    562595                $checked = in_array( $category->term_id, $checked_categories ) ? 'checked="checked"' : '';
    563596                ?>
    564597
  • wp-admin/js/post.dev.js

     
    228228})(jQuery);
    229229
    230230jQuery(document).ready( function($) {
    231         var catAddAfter, stamp, visibility, sticky = '', post = 'post' == pagenow || 'post-new' == pagenow, page = 'page' == pagenow || 'page-new' == pagenow;
     231        var stamp, visibility, sticky = '', post = 'post' == pagenow || 'post-new' == pagenow, page = 'page' == pagenow || 'page-new' == pagenow;
    232232
    233233        // postboxes
    234234        if ( post ) {
     
    253253        }
    254254
    255255        // categories
    256         if ( $('#categorydiv').length ) {
     256        $('.categorydiv').each(function(){
     257                var this_id = $(this).attr('id'), noSyncChecks = false, syncChecks, catAddAfter, popularCats;
     258                var taxonomy_parts = this_id.split('-');
     259                taxonomy_parts.shift();
     260                var taxonomy = taxonomy_parts.join('-');
     261                var settingName = taxonomy+'_tab';
     262                if(taxonomy == 'category')
     263                        settingName = 'cats';
     264                               
    257265                // TODO: move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.dev.js
    258                 $('a', '#category-tabs').click(function(){
     266                $('a', '#'+taxonomy+'-tabs').click(function(){
    259267                        var t = $(this).attr('href');
    260268                        $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
    261                         $('#category-tabs').siblings('.tabs-panel').hide();
     269                        $('#'+taxonomy+'-tabs').siblings('.tabs-panel').hide();
    262270                        $(t).show();
    263                         if ( '#categories-all' == t )
    264                                 deleteUserSetting('cats');
     271                        if ( '#'+taxonomy+'-all' == t )
     272                                deleteUserSetting(settingName);
    265273                        else
    266                                 setUserSetting('cats','pop');
     274                                setUserSetting(settingName,'pop');
    267275                        return false;
    268276                });
    269                 if ( getUserSetting('cats') )
    270                         $('a[href="#categories-pop"]', '#category-tabs').click();
     277               
     278                if ( getUserSetting(settingName) )
     279                        $('a[href="#'+taxonomy+'-pop"]', '#'+taxonomy+'-tabs').click();
    271280
    272281                // Ajax Cat
    273                 $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
    274                 $('#category-add-sumbit').click( function(){ $('#newcat').focus(); } );
    275 
     282                $('#new'+taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
     283                $('#'+taxonomy+'-add-submit').click(function(){$('#new'+taxonomy).focus();});
     284               
     285                syncChecks = function() {
     286                                if ( noSyncChecks )
     287                                        return;
     288                                noSyncChecks = true;
     289                                var th = jQuery(this), c = th.is(':checked'), id = th.val().toString();
     290                                $('#in-'+taxonomy+'-' + id + ', #in-'+taxonomy+'-category-' + id).attr( 'checked', c );
     291                                noSyncChecks = false;
     292                        };
     293                       
     294                       
     295               
    276296                catAddBefore = function( s ) {
    277                         if ( !$('#newcat').val() )
     297                        if ( !$('#new'+taxonomy).val() )
    278298                                return false;
    279                         s.data += '&' + $( ':checked', '#categorychecklist' ).serialize();
     299                        s.data += '&' + $( ':checked', '#'+taxonomy+'checklist' ).serialize();
    280300                        return s;
    281301                };
    282302
    283303                catAddAfter = function( r, s ) {
    284                         var sup, drop = $('#newcat_parent');
     304                        var sup, drop = $('#new'+taxonomy+'_parent');
    285305
    286306                        if ( 'undefined' != s.parsed.responses[0] && (sup = s.parsed.responses[0].supplemental.newcat_parent) ) {
    287307                                drop.before(sup);
     
    289309                        }
    290310                };
    291311
    292                 $('#categorychecklist').wpList({
     312                $('#'+taxonomy+'checklist').wpList({
    293313                        alt: '',
    294                         response: 'category-ajax-response',
     314                        response: taxonomy+'-ajax-response',
    295315                        addBefore: catAddBefore,
    296316                        addAfter: catAddAfter
    297317                });
    298 
    299                 $('#category-add-toggle').click( function() {
    300                         $('#category-adder').toggleClass( 'wp-hidden-children' );
    301                         $('a[href="#categories-all"]', '#category-tabs').click();
     318                $('#'+taxonomy+'-add-toggle').click( function() {
     319                        $('#'+taxonomy+'-adder').toggleClass( 'wp-hidden-children' );
     320                        $('a[href="#'+taxonomy+'-all"]', '#'+taxonomy+'-tabs').click();
    302321                        return false;
    303322                });
    304323
    305                 $('#categorychecklist').children('li.popular-category').add( $('#categorychecklist-pop').children() ).find(':checkbox').live( 'click', function(){
     324                $('#'+taxonomy+'checklist').children('li.popular-category').add( $('#'+taxonomy+'checklist-pop').children() ).find(':checkbox').live( 'click', function(){
    306325                        var t = $(this), c = t.is(':checked'), id = t.val();
    307                         $('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
     326                        $('#in-'+taxonomy+'-' + id + ', #in-popular-'+taxonomy+'-' + id).attr( 'checked', c );
    308327                });
    309328
    310         } // end cats
     329        }); // end cats
    311330
    312331        // Custom Fields
    313332        if ( $('#postcustom').length ) {
  • wp-admin/edit-form-advanced.php

     
    9494
    9595// all tag-style taxonomies
    9696foreach ( get_object_taxonomies($post_type) as $tax_name ) {
     97        $taxonomy = get_taxonomy($tax_name);
     98        $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
     99
    97100        if ( !is_taxonomy_hierarchical($tax_name) ) {
    98                 $taxonomy = get_taxonomy($tax_name);
    99                 $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
    100 
    101101                add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core');
    102102        }
     103        else {
     104                add_meta_box($tax_name.'div', $label, 'post_categories_meta_box', 'post', 'side', 'core', array('taxonomy'=>$tax_name));
     105        }
    103106}
    104107
    105 if ( is_object_in_taxonomy($post_type, 'category') )
    106         add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', $post_type, 'side', 'core');
    107 
    108108if ( post_type_supports($post_type, 'page-attributes') )
    109109        add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', $post_type, 'side', 'core');
    110110
  • wp-admin/css/colors-classic.dev.css

     
    110110}
    111111
    112112div.tabs-panel,
    113 ul#category-tabs li.tabs {
     113ul.category-tabs li.tabs {
    114114        border-color: #dfdfdf;
    115115}
    116116
    117 ul#category-tabs li.tabs {
     117ul.category-tabs li.tabs {
    118118        background-color: #f1f1f1;
    119119}
    120120
     
    384384        background: #faf9f7 !important;
    385385}
    386386
    387 #side-sortables #category-tabs .tabs a {
     387#side-sortables .category-tabs .tabs a {
    388388        color: #333;
    389389}
    390390
     
    14631463        background-color: #f5f5f5;
    14641464}
    14651465
    1466 #post-body ul#category-tabs li.tabs a {
     1466#post-body ul.category-tabs li.tabs a {
    14671467        color: #333;
    14681468}
    14691469
  • wp-admin/css/press-this.dev.css

     
    115115}
    116116
    117117#tagsdiv-post_tag h3,
    118 #categorydiv h3 {
     118.categorydiv h3 {
    119119        cursor: pointer;
    120120}
    121121
     
    308308        display: none;
    309309}
    310310
    311 #category-adder {
     311.category-adder {
    312312        padding: 4px 0;
    313313}
    314314
    315 #category-adder h4 {
     315.category-adder h4 {
    316316        margin: 0 0 8px;
    317317}
    318318
    319 #category-add input {
     319.category-add input {
    320320        width: 94%;
    321321        font-family: Verdana,Arial,Helvetica,sans-serif;
    322322        font-size: 13px;
     
    324324        padding: 3px;
    325325}
    326326
    327 #category-add select {
     327.category-add select {
    328328        width: 70%;
    329329        -x-system-font: none;
    330330        border-style: solid;
     
    338338        vertical-align: top;
    339339}
    340340
    341 #category-add input,
    342 #category-add-sumbit {
     341.category-add input,
     342.category-add-sumbit {
    343343        width: auto;
    344344}
    345345
    346346/* Categories */
    347 #categorydiv ul,
     347.categorydiv ul,
    348348#linkcategorydiv ul {
    349349        list-style: none;
    350350        padding: 0;
    351351        margin: 0;
    352352}
    353353
    354 #categorydiv ul.categorychecklist ul {
     354.categorydiv ul.categorychecklist ul {
    355355        margin-left: 18px;
    356356}
    357357
    358 #categorydiv div.tabs-panel {
     358.categorydiv div.tabs-panel {
    359359        height: 140px;
    360360        overflow: auto;
    361361}
  • wp-admin/css/colors-fresh.dev.css

     
    110110}
    111111
    112112div.tabs-panel,
    113 ul#category-tabs li.tabs {
     113ul.category-tabs li.tabs {
    114114        border-color: #dfdfdf;
    115115}
    116116
    117 ul#category-tabs li.tabs {
     117ul.category-tabs li.tabs {
    118118        background-color: #f1f1f1;
    119119}
    120120
     
    380380        border-color: #dfdfdf;
    381381}
    382382
    383 #side-sortables #category-tabs .tabs a {
     383#side-sortables .category-tabs .tabs a {
    384384        color: #333;
    385385}
    386386
     
    14581458        background-color: #f5f5f5;
    14591459}
    14601460
    1461 #post-body ul#category-tabs li.tabs a {
     1461#post-body ul.category-tabs li.tabs a {
    14621462        color: #333;
    14631463}
    14641464
  • wp-admin/css/wp-admin.dev.css

     
    19281928
    19291929/* Categories */
    19301930
    1931 #category-adder {
     1931.category-adder {
    19321932        margin-left: 120px;
    19331933        padding: 4px 0;
    19341934}
    19351935
    1936 #category-adder h4 {
     1936.category-adder h4 {
    19371937        margin: 0 0 8px;
    19381938}
    19391939
    1940 #side-sortables #category-adder {
     1940#side-sortables .category-adder {
    19411941        margin: 0;
    19421942}
    19431943
    1944 #post-body #category-add input, #category-add select {
     1944#post-body .category-add input, .category-add select {
    19451945        width: 30%;
    19461946}
    19471947
    1948 #side-sortables #category-add input {
     1948#side-sortables .category-add input {
    19491949        width: 94%;
    19501950}
    19511951
    1952 #side-sortables #category-add select {
     1952#side-sortables .category-add select {
    19531953        width: 100%;
    19541954}
    19551955
    1956 #category-add input#category-add-sumbit {
     1956#side-sortables .category-add input.category-add-sumbit, #post-body .category-add input.category-add input.category-add-sumbit {
    19571957        width: auto;
    19581958}
    19591959
    1960 #post-body ul#category-tabs {
     1960#post-body ul.category-tabs {
    19611961        float: left;
    19621962        width: 120px;
    19631963        text-align: right;
     
    19661966        padding: 0;
    19671967}
    19681968
    1969 #post-body ul#category-tabs li {
     1969#post-body ul.category-tabs li {
    19701970        padding: 8px;
    19711971}
    19721972
    1973 #post-body ul#category-tabs li.tabs {
     1973#post-body ul.category-tabs li.tabs {
    19741974        -moz-border-radius: 3px 0 0 3px;
    19751975        -webkit-border-top-left-radius: 3px;
    19761976        -webkit-border-bottom-left-radius: 3px;
     
    19801980        border-bottom-left-radius: 3px;
    19811981}
    19821982
    1983 #post-body ul#category-tabs li.tabs a {
     1983#post-body ul.category-tabs li.tabs a {
    19841984        font-weight: bold;
    19851985        text-decoration: none;
    19861986}
    19871987
    1988 #categorydiv div.tabs-panel,
     1988.categorydiv div.tabs-panel,
    19891989#linkcategorydiv div.tabs-panel {
    19901990        height: 200px;
    19911991        overflow: auto;
     
    19941994        border-width: 1px;
    19951995}
    19961996
    1997 #post-body #categorydiv div.tabs-panel,
     1997#post-body .categorydiv div.tabs-panel,
    19981998#post-body #linkcategorydiv div.tabs-panel {
    19991999        margin: 0 5px 0 125px;
    20002000}
    20012001
    2002 #side-sortables #category-tabs li {
     2002#side-sortables .category-tabs li {
    20032003        display: inline;
    20042004        padding-right: 8px;
    20052005}
    20062006
    2007 #side-sortables #category-tabs a {
     2007#side-sortables .category-tabs a {
    20082008        text-decoration: none;
    20092009}
    20102010
    2011 #side-sortables #category-tabs {
     2011#side-sortables .category-tabs {
    20122012        margin-bottom: 3px;
    20132013}
    20142014
    2015 #categorydiv ul,
     2015.categorydiv ul,
    20162016#linkcategorydiv ul {
    20172017        list-style: none;
    20182018        padding: 0;
    20192019        margin: 0;
    20202020}
    20212021
    2022 #categorydiv ul.categorychecklist ul,
     2022.categorydiv ul.categorychecklist ul,
    20232023#linkcategorydiv ul.categorychecklist ul {
    20242024        margin-left: 18px;
    20252025}
     
    20302030        line-height: 19px;
    20312031}
    20322032
    2033 #category-adder h4 {
     2033.category-adder h4 {
    20342034        margin-top: 4px;
    20352035        margin-bottom: 0px;
    20362036}
    20372037
    2038 #categorydiv .tabs-panel {
     2038.categorydiv .tabs-panel {
    20392039        border-width: 3px;
    20402040        border-style: solid;
    20412041}
    20422042
    2043 ul#category-tabs {
     2043ul.category-tabs {
    20442044        margin-top: 12px;
    20452045}
    20462046
    2047 ul#category-tabs li.tabs {
     2047ul.category-tabs li.tabs {
    20482048        border-style: solid solid none;
    20492049        border-width: 1px 1px 0;
    20502050}
    20512051
    2052 #post-body #category-tabs li.tabs {
     2052#post-body .category-tabs li.tabs {
    20532053        border-style: solid none solid solid;
    20542054        border-width: 1px 0 1px 1px;
    20552055        margin-right: -1px;
    20562056}
    20572057
    2058 ul#category-tabs li {
     2058ul.category-tabs li {
    20592059        padding: 5px 8px;
    20602060        -moz-border-radius: 3px 3px 0 0;
    20612061        -webkit-border-top-left-radius: 3px;
  • wp-admin/css/wp-admin-rtl.css

     
    294294        margin-left: 4px;
    295295}
    296296/* Categories */
    297 #category-adder {
     297.category-adder {
    298298        margin-left: 0;
    299299        margin-right: 120px;
    300300}
    301 #post-body ul#category-tabs li.tabs {
     301#post-body ul.category-tabs li.tabs {
    302302        -moz-border-radius: 0 3px 3px 0;
    303303        -webkit-border-top-left-radius: 0;
    304304        -webkit-border-top-right-radius: 3px;
     
    309309        border-bottom-left-radius: 0;
    310310        border-bottom-right-radius: 3px;
    311311}
    312 #post-body ul#category-tabs {
     312#post-body ul.category-tabs {
    313313        float: right;
    314314        text-align: left;
    315315        margin: 0 0 0 -120px;
    316316}
    317 #post-body #categorydiv div.tabs-panel,
     317#post-body .categorydiv div.tabs-panel,
    318318#post-body #linkcategorydiv div.tabs-panel {
    319319        margin: 0 120px 0 5px;
    320320}
    321321/* 1800 - 2000
    322322=================================== */
    323 #side-sortables #category-tabs li {
     323#side-sortables .category-tabs li {
    324324        padding-right: 0;
    325325        padding-left: 8px;
    326326}
    327 #categorydiv ul.categorychecklist ul,
     327.categorydiv ul.categorychecklist ul,
    328328#linkcategorydiv ul.categorychecklist ul {
    329329        margin-left: 0;
    330330        margin-right: 18px;