From c9112aa5d77009cc3c92154e00b06a5479e187d5 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 18 Sep 2008 22:31:25 +0000 Subject: [PATCH] Column hiding for categories. see #7725 git-svn-id: https://develop.svn.wordpress.org/trunk@8932 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/template.php | 44 ++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index d58db752d3..9c3b494043 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -103,17 +103,41 @@ function _cat_row( $category, $level, $name_override = false ) { $category->count = number_format_i18n( $category->count ); $posts_count = ( $category->count > 0 ) ? "$category->count" : $category->count; - $output = " - "; - if ( $default_cat_id != $category->term_id ) { - $output .= ""; - } else { - $output .= " "; + $output = ""; + + $columns = get_column_headers('category'); + $hidden = (array) get_user_option( 'manage-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 ( $default_cat_id != $category->term_id ) { + $output .= ""; + } else { + $output .= " "; + } + $output .= ''; + break; + case 'name': + $output .= "$edit"; + break; + case 'description': + $output .= "$category->description"; + break; + case 'posts': + $attributes = 'class="posts column-posts num"' . $style; + $output .= "$posts_count\n"; + } } - $output .= " - $edit - $category->description - $posts_count\n\t\n"; + $output .= ''; return apply_filters('cat_row', $output); }