Ticket #21240: 21240.4.diff
File 21240.4.diff, 8.7 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
27 27 'capability_type' => 'post', 28 28 'map_meta_cap' => true, 29 29 'hierarchical' => false, 30 'show_taxonomy_columns' => array( 'category', 'post_tag' ), 30 31 'rewrite' => false, 31 32 'query_var' => false, 32 33 'delete_with_user' => true, … … 977 978 $defaults = array( 978 979 'labels' => array(), 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, 979 980 'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null, 980 '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false, 981 '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false, 'show_taxonomy_columns' => false, 981 982 'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true, 982 983 'supports' => array(), 'register_meta_box_cb' => null, 983 984 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, … … 1285 1286 if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) 1286 1287 $object->labels['all_items'] = $object->labels['menu_name']; 1287 1288 1289 if ( !isset( $object->labels['no_items'] ) && isset( $object->labels['menu_name'] ) ) 1290 $object->labels['no_items'] = 'No ' . $object->labels['menu_name']; 1291 1288 1292 foreach ( $nohier_vs_hier_defaults as $key => $value ) 1289 1293 $defaults[$key] = $object->hierarchical ? $value[1] : $value[0]; 1290 1294 -
wp-includes/taxonomy.php
43 43 44 44 register_taxonomy( 'category', 'post', array( 45 45 'hierarchical' => true, 46 'labels' => array( 47 'no_items' => __( 'Uncategorized' ), 48 ), 46 49 'query_var' => 'category_name', 47 50 'rewrite' => $rewrite['category'], 48 51 'public' => true, … … 416 419 'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ), 417 420 'popular_items' => array( __( 'Popular Tags' ), null ), 418 421 'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ), 422 'no_items' => array( __( 'No Tags' ), __( 'No Categories' ) ), 419 423 'parent_item' => array( null, __( 'Parent Category' ) ), 420 424 'parent_item_colon' => array( null, __( 'Parent Category:' ) ), 421 425 'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ), -
wp-admin/includes/class-wp-posts-list-table.php
270 270 $posts_columns['author'] = __( 'Author' ); 271 271 272 272 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) ) 273 $posts_columns['categor ies'] = __( 'Categories' );273 $posts_columns['category'] = __( 'Categories' ); 274 274 275 275 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) ) 276 $posts_columns[' tags'] = __( 'Tags' );276 $posts_columns['post_tag'] = __( 'Tags' ); 277 277 278 278 $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; 279 279 if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) … … 287 287 $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); 288 288 $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); 289 289 290 if ( empty( $post_type ) ) return $posts_columns; 291 292 $post_type_object = get_post_type_object( $post_type ); 293 $registered_taxonomies = get_object_taxonomies( $post_type ); 294 295 if ( $post_type_object->show_taxonomy_columns && is_array( $post_type_object->show_taxonomy_columns ) ) 296 $taxonomies = $post_type_object->show_taxonomy_columns; 297 elseif ( $post_type_object->show_taxonomy_columns ) 298 $taxonomies = $registered_taxonomies; 299 else 300 $taxonomies = array(); 301 302 $this->taxonomy_columns = apply_filters( 'show_taxonomy_columns', $taxonomies, $post_type ); 303 304 if ( empty( $this->taxonomy_columns ) ) return $posts_columns; 305 306 foreach ( $this->taxonomy_columns as $registered_taxonomy ) { 307 308 if ( !in_array( $registered_taxonomy, $registered_taxonomies ) ) continue; 309 if ( $registered_taxonomy == 'post_tag' || $registered_taxonomy == 'category' ) continue; 310 311 $taxonomy_object = get_taxonomy( $registered_taxonomy ); 312 $posts_columns[$registered_taxonomy] = apply_filters( 'taxonomy_column_header', __( $taxonomy_object->label ), $post_type_object, $taxonomy_object ); 313 } 314 290 315 return $posts_columns; 291 316 } 292 317 … … 529 554 } 530 555 else { 531 556 $attributes = 'class="post-title page-title column-title"' . $style; 532 533 557 $pad = str_repeat( '— ', $level ); 534 558 ?> 535 559 <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); ?></strong> … … 603 627 echo '</td>'; 604 628 break; 605 629 606 case 'categories': 607 ?> 608 <td <?php echo $attributes ?>><?php 609 $categories = get_the_category(); 610 if ( !empty( $categories ) ) { 611 $out = array(); 612 foreach ( $categories as $c ) { 613 $out[] = sprintf( '<a href="%s">%s</a>', 614 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'category_name' => $c->slug ), 'edit.php' ) ), 615 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) 616 ); 617 } 618 /* translators: used between list items, there is a space after the comma */ 619 echo join( __( ', ' ), $out ); 620 } else { 621 _e( 'Uncategorized' ); 622 } 623 ?></td> 624 <?php 625 break; 630 case ( is_array( $this->taxonomy_columns ) && in_array( $column_name, $this->taxonomy_columns ) ) : 626 631 627 case 'tags': 628 ?> 629 <td <?php echo $attributes ?>><?php 630 $tags = get_the_tags( $post->ID ); 631 if ( !empty( $tags ) ) { 632 $out = array(); 633 foreach ( $tags as $c ) { 634 $out[] = sprintf( '<a href="%s">%s</a>', 635 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'tag' => $c->slug ), 'edit.php' ) ), 636 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'tag', 'display' ) ) 637 ); 638 } 639 /* translators: used between list items, there is a space after the comma */ 640 echo join( __( ', ' ), $out ); 641 } else { 642 _e( 'No Tags' ); 643 } 644 ?></td> 645 <?php 632 $defaults = array( 633 'taxonomy' => $column_name, 634 'attributes' => $attributes, 635 ); 636 $args = apply_filters( 'taxonomy_column_args', $defaults, $post_type_object, $column_name ); 637 638 $this->taxonomy_column( $args ); 646 639 break; 647 640 648 641 case 'comments': … … 679 672 ?></td> 680 673 <?php 681 674 break; 675 } 682 676 } 683 }684 677 ?> 685 678 </tr> 686 679 <?php … … 688 681 } 689 682 690 683 /** 684 * Creates internal taxonomy columns as well as registered taxonomies 685 * 686 * @since 3.5.0 687 */ 688 function taxonomy_column( $atts = array() ) { 689 global $post; 690 691 $defaults = array( 692 'taxonomy' => 'category', 693 'attributes' => '', 694 'empty' => '', 695 ); 696 $args = wp_parse_args( (array) $atts, $defaults ); 697 extract( $args, EXTR_SKIP ); 698 699 $attributes = !empty( $attributes ) ? $attributes : 'class="column-'. $taxonomy .'"'; 700 $taxonomy_object = get_taxonomy( $taxonomy ); 701 702 ?> 703 <td <?php echo $attributes ?>><?php 704 $terms = get_the_terms( $post->ID, $taxonomy ); 705 if ( !empty( $terms ) ) { 706 $out = array(); 707 foreach ( $terms as $t ) { 708 $out[] = sprintf( '<a href="%s">%s</a>', 709 esc_url( add_query_arg( array( 'post_type' => $post->post_type, $taxonomy_object->query_var => $t->slug ), 'edit.php' ) ), 710 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) 711 ); 712 } 713 /* translators: used between list items, there is a space after the comma */ 714 echo join( __( ', ' ), $out ); 715 } else { 716 echo $taxonomy_object->labels->no_items; 717 } 718 ?></td> 719 <?php 720 } 721 722 /** 691 723 * Outputs the hidden row displayed when inline editing 692 724 * 693 725 * @since 3.1.0 -
wp-admin/css/wp-admin.dev.css
2350 2350 2351 2351 .fixed .column-response, 2352 2352 .fixed .column-author, 2353 .fixed .column-categor ies,2354 .fixed .column- tags,2353 .fixed .column-category, 2354 .fixed .column-post_tag, 2355 2355 .fixed .column-rel, 2356 2356 .fixed .column-role { 2357 2357 width: 15%;