From 3b1e1f03765b8cc8ab776b0afb50acc107082216 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Mon, 17 Aug 2015 15:37:03 +0000 Subject: [PATCH] List tables: Yet more primary column fallbacks. Some custom list tables override enough methods for the column definition fallback to never kick in, so let's ensure that toggling columns only applies when a primary column is defined in some way. We also need to show a toggle button when we can when there are no row actions. props Chouby, obenland, ocean90. fixes #33313. git-svn-id: https://develop.svn.wordpress.org/trunk@33623 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/list-tables.css | 9 ++++----- src/wp-admin/includes/class-wp-list-table.php | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index e1fd1fff59..fdaa733abe 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -1764,9 +1764,8 @@ div.action-links, font-size: 14px; } - .wp-list-table th:not(.column-primary), - .wp-list-table th:not(.column-primary), - .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.column-primary):not(.check-column) { + .wp-list-table th.column-primary ~ th, + .wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary ~ td:not(.check-column) { display: none; } @@ -1780,7 +1779,7 @@ div.action-links, width: 35px; } - .wp-list-table .toggle-row { + .wp-list-table .column-primary .toggle-row { display: block; } @@ -1795,7 +1794,7 @@ div.action-links, padding-right: 50px; /* space for toggle button */ } - .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.column-primary):not(.check-column) { + .wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary ~ td:not(.check-column) { padding: 3px 8px 3px 35%; } diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 2dd437a185..ad35fc670a 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -1258,7 +1258,7 @@ class WP_List_Table { * @return string The row actions output. In this case, an empty string. */ protected function handle_row_actions( $item, $column_name, $primary ) { - return ''; + return $column_name == $primary ? '' : ''; } /**