Ticket #21240: 21240.5.diff
File 21240.5.diff, 6.3 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/class-wp-posts-list-table.php
275 275 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) ) 276 276 $posts_columns['tags'] = __( 'Tags' ); 277 277 278 $post_type_object = get_post_type_object( $post_type ); 279 $registered_taxonomies = get_object_taxonomies( $post_type ); 280 281 if ( $post_type_object->show_taxonomy_columns && is_array( $post_type_object->show_taxonomy_columns ) ) 282 $taxonomies = $post_type_object->show_taxonomy_columns; 283 elseif ( $post_type_object->show_taxonomy_columns ) 284 $taxonomies = $registered_taxonomies; 285 else 286 $taxonomies = array(); 287 288 $taxonomies = array_diff( $taxonomies, array( 'category', 'post_tag' ) ); 289 $this->taxonomy_columns = array_merge( array( 'categories', 'tags' ), $taxonomies ); 290 $this->taxonomy_columns = apply_filters( 'show_taxonomy_columns', $this->taxonomy_columns, $post_type ); 291 292 foreach ( $this->taxonomy_columns as $taxonomy ) { 293 if ( ! in_array( $taxonomy, $registered_taxonomies ) ) 294 continue; 295 296 $taxonomy_object = get_taxonomy( $taxonomy ); 297 $posts_columns[ $taxonomy ] = $taxonomy_object->labels->name; 298 } 299 278 300 $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; 279 301 if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) 280 302 $posts_columns['comments'] = '<span class="vers"><img alt="' . esc_attr__( 'Comments' ) . '" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></span>'; … … 529 551 } 530 552 else { 531 553 $attributes = 'class="post-title page-title column-title"' . $style; 532 554 533 555 $pad = str_repeat( '— ', $level ); 534 556 ?> 535 557 <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 625 echo '</td>'; 604 626 break; 605 627 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; 628 case ( in_array( $column_name, $this->taxonomy_columns ) ) : 629 $taxonomy = $column_name; 630 if ( 'categories' == $column_name ) 631 $taxonomy = 'category'; 632 elseif ( 'tags' == $column_name ) 633 $taxonomy = 'post_tag'; 626 634 627 case 'tags':635 $taxonomy_object = get_taxonomy( $taxonomy ); 628 636 ?> 629 637 <td <?php echo $attributes ?>><?php 630 $t ags = get_the_tags( $post->ID);631 if ( !empty( $t ags ) ) {638 $terms = get_the_terms( $post->ID, $taxonomy ); 639 if ( !empty( $terms ) ) { 632 640 $out = array(); 633 foreach ( $t ags as $c) {641 foreach ( $terms as $t ) { 634 642 $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' ) )643 esc_url( add_query_arg( array( 'post_type' => $post->post_type, $taxonomy_object->query_var => $t->slug ), 'edit.php' ) ), 644 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) 637 645 ); 638 646 } 639 647 /* translators: used between list items, there is a space after the comma */ 640 648 echo join( __( ', ' ), $out ); 641 649 } else { 642 _e( 'No Tags' );650 echo $taxonomy_object->labels->no_items; 643 651 } 644 652 ?></td> 645 653 <?php … … 679 687 ?></td> 680 688 <?php 681 689 break; 690 } 682 691 } 683 }684 692 ?> 685 693 </tr> 686 694 <?php -
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, … … 980 981 '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false, 981 982 'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true, 982 983 'supports' => array(), 'register_meta_box_cb' => null, 983 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 984 'taxonomies' => array(), 'show_taxonomy_columns' => false, 985 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 984 986 'can_export' => true, 985 987 'show_in_nav_menus' => null, 'show_in_menu' => null, 'show_in_admin_bar' => null, 986 988 'delete_with_user' => null, -
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' ) ),