Ticket #26268: 26268.10.diff
File 26268.10.diff, 3.2 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/class-wp-terms-list-table.php
236 236 } else { 237 237 $children = _get_term_hierarchy( $taxonomy ); 238 238 } 239 // Handle custom display of default category by showing it first in the list 240 241 if ( 'category' == $taxonomy ) { 242 $default_category = get_term( get_option( 'default_category' ), 'category' ); 243 $this->single_row( $default_category ); 244 } 245 239 246 // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake 240 247 $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); 241 248 } else { 249 $terms = get_terms( $taxonomy, $args ); 250 // Handle custom display of default category by showing it first in the list 251 252 $default_category_id = false; 253 if ( 'category' == $taxonomy ) { 254 $default_category = get_term( get_option( 'default_category' ), 'category' ); 255 $this->single_row( $default_category ); 256 $default_category_id = $default_category->term_id; 257 } 242 258 foreach ( $terms as $term ) { 259 if ( $default_category_id == $term->term_taxonomy_id ) { 260 continue; 261 } 243 262 $this->single_row( $term ); 244 263 } 245 264 } … … 259 278 260 279 $end = $start + $per_page; 261 280 281 // Handle display of default category by showing it first in the list, capture default category id 282 283 $default_category_id = false; 284 if ( 'category' == $taxonomy ) { 285 $default_category_id = get_option( 'default_category' ); 286 } 287 262 288 foreach ( $terms as $key => $term ) { 263 289 264 290 if ( $count >= $end ) … … 267 293 if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) 268 294 continue; 269 295 296 // Skip duplicating display of default category 297 if ( $default_category_id == $term->term_taxonomy_id ) { 298 continue; 299 } 300 270 301 // If the page starts in a subtree, print the parents. 271 302 if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { 272 303 $my_parents = $parent_ids = array(); … … 340 371 public function column_name( $tag ) { 341 372 $taxonomy = $this->screen->taxonomy; 342 373 374 $default_term = get_option( 'default_' . $taxonomy ); 375 $default_term_label = ''; 376 if ( $tag->term_id == $default_term ) { 377 $default_term_label = ' - <span class="taxonomy-label"> ' . __( 'Default' ) . '</span>'; 378 } 379 343 380 $pad = str_repeat( '— ', max( 0, $this->level ) ); 344 381 345 382 /** … … 360 397 $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 361 398 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 362 399 363 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a> </strong><br />';400 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a>' . $default_term_label . '</strong><br />'; 364 401 365 402 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; 366 403 $out .= '<div class="name">' . $qe_data->name . '</div>';