Ticket #26268: 26268.8.diff
File 26268.8.diff, 3.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/class-wp-terms-list-table.php
198 198 } else { 199 199 $children = _get_term_hierarchy( $taxonomy ); 200 200 } 201 // Handle custom display of default category by showing it first in the list 202 203 if ( 'category' == $taxonomy ) { 204 $default_category = get_term( get_option( 'default_category' ), 'category' ); 205 $this->single_row( $default_category ); 206 } 207 201 208 // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake 202 209 $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); 203 210 } else { 204 211 $terms = get_terms( $taxonomy, $args ); 212 213 // Handle custom display of default category by showing it first in the list 214 215 $default_category_id = false; 216 if ( 'category' == $taxonomy ) { 217 $default_category = get_term( get_option( 'default_category' ), 'category' ); 218 $this->single_row( $default_category ); 219 $default_category_id = $default_category->term_id; 220 } 221 205 222 foreach ( $terms as $term ) { 223 if ( $default_category_id == $term->term_taxonomy_id ) { 224 continue; 225 } 206 226 $this->single_row( $term ); 207 227 } 208 228 } … … 222 242 223 243 $end = $start + $per_page; 224 244 245 // Handle display of default category by showing it first in the list, capture default category id 246 247 $default_category_id = false; 248 if ( 'category' == $taxonomy ) { 249 $default_category_id = get_option( 'default_category' ); 250 } 251 225 252 foreach ( $terms as $key => $term ) { 226 253 227 254 if ( $count >= $end ) … … 230 257 if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) 231 258 continue; 232 259 233 // If the page starts in a subtree, print the parents. 260 // Skip duplicating display of default category 261 if ( $default_category_id == $term->term_taxonomy_id ) { 262 continue; 263 } 264 265 // If the page starts in a subtree, print the parents. 234 266 if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { 235 267 $my_parents = $parent_ids = array(); 236 268 $p = $term->parent; … … 306 338 307 339 $default_term = get_option( 'default_' . $taxonomy ); 308 340 341 $default_term_label = ''; 342 if ( $tag->term_id == $default_term ) { 343 $default_term_label = ' - <span class="taxonomy-label"> ' . __( 'Default' ) . '</span>'; 344 } 345 309 346 $pad = str_repeat( '— ', max( 0, $this->level ) ); 310 347 311 348 /** … … 326 363 $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 327 364 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 328 365 329 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 366 $default_categories = array( 367 'category', 368 'link_category' 369 ); 330 370 371 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a>' . $default_term_label . '</strong><br />'; 372 331 373 $actions = array(); 332 374 if ( current_user_can( $tax->cap->edit_terms ) ) { 333 375 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';