';
foreach ( $actions as $action => $link ) {
++$i;
( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php
index e6d829e39f..a2851203e1 100644
--- a/src/wp-admin/includes/class-wp-list-table.php
+++ b/src/wp-admin/includes/class-wp-list-table.php
@@ -166,8 +166,8 @@ class WP_List_Table {
if ( empty( $this->modes ) ) {
$this->modes = array(
- 'list' => __( 'List View' ),
- 'excerpt' => __( 'Excerpt View' ),
+ 'list' => __( 'Compact View' ),
+ 'extended' => __( 'Extended View' ),
);
}
}
@@ -523,6 +523,11 @@ class WP_List_Table {
return '';
}
+ $mode = get_user_setting( 'posts_list_mode', 'list' );
+ if ( 'extended' === $mode ) {
+ $always_visible = true;
+ }
+
$out = '
';
foreach ( $actions as $action => $link ) {
++$i;
@@ -1247,7 +1252,22 @@ class WP_List_Table {
* @return string[] Array of CSS classes for the table tag.
*/
protected function get_table_classes() {
- return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
+ $mode = get_user_setting( 'posts_list_mode', 'list' );
+ $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-list';
+ $mode = get_user_setting( 'posts_list_mode', 'list' );
+ /**
+ * Filters the current view mode.
+ *
+ * @since 5.5.0
+ *
+ * @param string $mode The current selected mode. Default value of
+ * posts_list_mode user setting.
+ */
+ $mode = apply_filters( 'table_view_mode', $mode );
+
+ $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode;
+
+ return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] );
}
/**
diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php
index 141ca89a58..b3d9e7da31 100644
--- a/src/wp-admin/includes/class-wp-posts-list-table.php
+++ b/src/wp-admin/includes/class-wp-posts-list-table.php
@@ -178,7 +178,7 @@ class WP_Posts_List_Table extends WP_List_Table {
}
if ( ! empty( $_REQUEST['mode'] ) ) {
- $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
+ $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list';
set_user_setting( 'posts_list_mode', $mode );
} else {
$mode = get_user_setting( 'posts_list_mode', 'list' );
@@ -598,7 +598,22 @@ class WP_Posts_List_Table extends WP_List_Table {
* @return array
*/
protected function get_table_classes() {
- return array( 'widefat', 'fixed', 'striped', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
+ $mode = get_user_setting( 'posts_list_mode', 'list' );
+ $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-list';
+ $mode = get_user_setting( 'posts_list_mode', 'list' );
+ /**
+ * Filters the current view mode.
+ *
+ * @since 5.5.0
+ *
+ * @param string $mode The current selected mode. Default value of
+ * posts_list_mode user setting.
+ */
+ $mode = apply_filters( 'table_view_mode', $mode );
+
+ $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode;
+
+ return array( 'widefat', 'fixed', 'striped', $mode_class, is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
}
/**
@@ -1042,7 +1057,7 @@ class WP_Posts_List_Table extends WP_List_Table {
}
echo "\n";
- if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) {
+ if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'extended' === $mode && current_user_can( 'read_post', $post->ID ) ) {
if ( post_password_required( $post ) ) {
echo '' . esc_html( get_the_excerpt() ) . '';
} else {
@@ -1102,7 +1117,7 @@ class WP_Posts_List_Table extends WP_List_Table {
* @param string $status The status text.
* @param WP_Post $post Post object.
* @param string $column_name The column name.
- * @param string $mode The list display mode ('excerpt' or 'list').
+ * @param string $mode The list display mode ('extended' or 'list').
*/
$status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode );
@@ -1121,7 +1136,7 @@ class WP_Posts_List_Table extends WP_List_Table {
* @param string $t_time The published time.
* @param WP_Post $post Post object.
* @param string $column_name The column name.
- * @param string $mode The list display mode ('excerpt' or 'list').
+ * @param string $mode The list display mode ('extended' or 'list').
*/
echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode );
}
@@ -1491,7 +1506,7 @@ class WP_Posts_List_Table extends WP_List_Table {
}
}
- $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list';
+ $m = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : 'list';
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
$core_columns = array(
'cb' => true,
diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php
index e3a2fcd7a6..dace397437 100644
--- a/src/wp-admin/includes/class-wp-screen.php
+++ b/src/wp-admin/includes/class-wp-screen.php
@@ -1288,17 +1288,12 @@ final class WP_Screen {
public function render_view_mode() {
$screen = get_current_screen();
- // Currently only enabled for posts lists.
- if ( 'edit' !== $screen->base ) {
+ // Currently only enabled for posts and comments lists.
+ if ( 'edit' !== $screen->base && 'edit-comments' !== $screen->base ) {
return;
}
- $view_mode_post_types = get_post_types(
- array(
- 'hierarchical' => false,
- 'show_ui' => true,
- )
- );
+ $view_mode_post_types = get_post_types( array( 'show_ui' => true ) );
/**
* Filters the post types that have different view mode options.
@@ -1306,15 +1301,28 @@ final class WP_Screen {
* @since 4.4.0
*
* @param string[] $view_mode_post_types Array of post types that can change view modes.
- * Default non-hierarchical post types with show_ui on.
+ * Default post types with show_ui on.
*/
$view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );
- if ( ! in_array( $this->post_type, $view_mode_post_types, true ) ) {
+ if ( 'edit' === $screen->base && ! in_array( $this->post_type, $view_mode_post_types, true ) ) {
return;
}
- global $mode;
+ $mode = get_user_setting( 'posts_list_mode', 'list' );
+
+ // Set 'list' as default value if $mode is not set.
+ $mode = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : 'list';
+
+ /**
+ * Filters the current view mode.
+ *
+ * @since 5.5.0
+ *
+ * @param string $mode The current selected mode. Default value of
+ * posts_list_mode user setting.
+ */
+ $mode = apply_filters( 'table_view_mode', $mode );
// This needs a submit button.
add_filter( 'screen_options_show_submit', '__return_true' );
@@ -1323,12 +1331,22 @@ final class WP_Screen {
+