Ticket #21240: 21240.2.diff
File 21240.2.diff, 9.0 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 ) ) { 291 $post_type_object = get_post_type_object( $post_type ); 292 293 if ( $post_type_object->show_taxonomy_columns ) { 294 295 if ( is_array( $post_type_object->show_taxonomy_columns ) ) 296 $taxonomies = $post_type_object->show_taxonomy_columns; 297 else 298 $taxonomies = get_object_taxonomies( $screen->post_type ); 299 300 if ( empty( $taxonomies ) ) 301 return $posts_columns; 302 303 foreach ( $taxonomies as $registered_taxonomy ) { 304 305 if ( $registered_taxonomy == 'post_tag' || $registered_taxonomy == 'category' ) continue; 306 307 $taxonomy_object = get_taxonomy( $registered_taxonomy ); 308 $posts_columns[$registered_taxonomy] = apply_filters( 'taxonomy_column_header', __( $taxonomy_object->label ), $post_type_object, $taxonomy_object ); 309 310 } 311 } 312 } 313 290 314 return $posts_columns; 291 315 } 292 316 … … 469 493 $edit_link = get_edit_post_link( $post->ID ); 470 494 $title = _draft_or_post_title(); 471 495 $post_type_object = get_post_type_object( $post->post_type ); 496 if ( $post_type_object->show_taxonomy_columns ) { 497 if ( is_array( $post_type_object->show_taxonomy_columns ) ) 498 $taxonomies_columns = $post_type_object->show_taxonomy_columns; 499 else 500 $taxonomies_columns = get_object_taxonomies( $post_type_object->name ); 501 } 472 502 $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); 473 503 474 504 $alternate = 'alternate' == $alternate ? '' : 'alternate'; … … 529 559 } 530 560 else { 531 561 $attributes = 'class="post-title page-title column-title"' . $style; 532 533 562 $pad = str_repeat( '— ', $level ); 534 563 ?> 535 564 <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 632 echo '</td>'; 604 633 break; 605 634 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; 635 case ( is_array( $taxonomies_columns ) && in_array( $registered_taxonomy = $column_name, $taxonomies_columns ) ) : 626 636 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 637 $defaults = array( 638 'taxonomy' => $registered_taxonomy, 639 'attributes' => $attributes, 640 ); 641 $args = apply_filters( 'taxonomy_column_args', $defaults, $post_type_object, $registered_taxonomy ); 642 643 $this->taxonomy_column( $args ); 646 644 break; 647 645 648 646 case 'comments': … … 679 677 ?></td> 680 678 <?php 681 679 break; 680 } 682 681 } 683 }684 682 ?> 685 683 </tr> 686 684 <?php … … 688 686 } 689 687 690 688 /** 689 * Creates internal taxonomy columns as well as registered taxonomies 690 * 691 * @since 3.5.0 692 */ 693 function taxonomy_column( $atts = array() ) { 694 global $post; 695 696 $defaults = array( 697 'taxonomy' => 'category', 698 'attributes' => '', 699 'empty' => '', 700 ); 701 $args = wp_parse_args( (array) $atts, $defaults ); 702 extract( $args, EXTR_SKIP ); 703 704 $attributes = !empty( $attributes ) ? $attributes : 'class="column-'. $taxonomy .'"'; 705 $taxonomy_object = get_taxonomy( $taxonomy ); 706 707 ?> 708 <td <?php echo $attributes ?>><?php 709 $terms = get_the_terms( $post->ID, $taxonomy ); 710 if ( !empty( $terms ) ) { 711 $out = array(); 712 foreach ( $terms as $t ) { 713 $out[] = sprintf( '<a href="%s">%s</a>', 714 esc_url( add_query_arg( array( 'post_type' => $post->post_type, $taxonomy_object->query_var => $t->slug ), 'edit.php' ) ), 715 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) 716 ); 717 } 718 /* translators: used between list items, there is a space after the comma */ 719 echo join( __( ', ' ), $out ); 720 } else { 721 echo $taxonomy_object->labels->no_items; 722 } 723 ?></td> 724 <?php 725 } 726 727 /** 691 728 * Outputs the hidden row displayed when inline editing 692 729 * 693 730 * @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%;