From 2e39212848bc6a6de15f4217449ae5cb947e2a8d Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 18 Sep 2008 20:13:10 +0000 Subject: [PATCH] Column hiding for tags. see #7725 git-svn-id: http://svn.automattic.com/wordpress/trunk@8930 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-tags.php | 1 + wp-admin/includes/template.php | 49 ++++++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 3312d45803..a5c2b309b2 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -207,6 +207,7 @@ $count = tag_rows( $pagenum, $tagsperpage, $searchterms ); ?> +
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 340114ccff..d58db752d3 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -326,21 +326,42 @@ function _tag_row( $tag, $class = '' ) { $edit_link = "edit-tags.php?action=edit&tag_ID=$tag->term_id"; $out = ''; $out .= ''; - $out .= ' '; - $out .= '' . $name . '
'; - $actions = array(); - $actions['edit'] = '' . __('Edit') . ''; - $actions['delete'] = "term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . ""; - $action_count = count($actions); - $i = 0; - foreach ( $actions as $action => $link ) { - ++$i; - ( $i == $action_count ) ? $sep = '' : $sep = ' | '; - $out .= "$link$sep"; - } - $out .= ''; + $columns = get_column_headers('tag'); + $hidden = (array) get_user_option( 'manage-tag-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': + $out .= ' '; + break; + case 'name': + $out .= '' . $name . '
'; + $actions = array(); + $actions['edit'] = '' . __('Edit') . ''; + $actions['delete'] = "term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . ""; + $action_count = count($actions); + $i = 0; + foreach ( $actions as $action => $link ) { + ++$i; + ( $i == $action_count ) ? $sep = '' : $sep = ' | '; + $out .= "$link$sep"; + } + $out .= ''; + break; + case 'posts': + $attributes = 'class="posts column-posts num"' . $style; + $out .= "$count"; + break; + } + } - $out .= "$count"; $out .= ''; return $out;