From efcee8d1960d162325340204dad0eaea1732b75a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 18 Sep 2008 22:52:07 +0000 Subject: [PATCH] Column hiding for link categories. see #7725 git-svn-id: https://develop.svn.wordpress.org/trunk@8933 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/template.php | 44 +++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 9c3b494043..17c7bb3326 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -39,7 +39,6 @@ function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $p // If the page starts in a subtree, print the parents. if ( $count == $start && $category->parent > 0 ) { $my_parents = array(); - $my_parent = $category->parent; while ( $my_parent) { $my_parent = get_category($my_parent); $my_parents[] = $my_parent; @@ -174,17 +173,40 @@ function link_cat_row( $category ) { $category->count = number_format_i18n( $category->count ); $count = ( $category->count > 0 ) ? "$category->count" : $category->count; - $output = " - "; - if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) { - $output .= ""; - } else { - $output .= " "; + $output = ""; + $columns = get_column_headers('link-category'); + $hidden = (array) get_user_option( 'manage-link-category-columns-hidden' ); + foreach ( $columns as $column_name => $column_display_name ) { + $class = "class=\"$column_name column-$column_name\""; + + $style = ''; + if ( in_array($column_name, $hidden) ) + $style = ' style="display:none;"'; + + $attributes = "$class$style"; + + switch ($column_name) { + case 'cb': + $output .= ""; + if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) { + $output .= ""; + } else { + $output .= " "; + } + $output .= ""; + break; + case 'name': + $output .= "$edit"; + break; + case 'description': + $output .= "$category->description"; + break; + case 'links': + $attributes = 'class="links column-links num"' . $style; + $output .= "$count"; + } } - $output .= " - $edit - $category->description - $count"; + $output .= ''; return apply_filters( 'link_cat_row', $output ); }