@@ -1018,9 +1018,13 @@ private function _page_rows( &$children_pages, &$count, $parent_page, $level, $p
10181018 * @since 4.3.0
10191019 * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
10201020 *
1021+ * @global string $mode List table view mode.
1022+ *
10211023 * @param WP_Post $item The current WP_Post object.
10221024 */
10231025 public function column_cb ( $ item ) {
1026+ global $ mode ;
1027+
10241028 // Restores the more descriptive, specific name for use within this method.
10251029 $ post = $ item ;
10261030
@@ -1037,13 +1041,23 @@ public function column_cb( $item ) {
10371041 * @param WP_Post $post The current WP_Post object.
10381042 */
10391043 if ( apply_filters ( 'wp_list_table_show_post_checkbox ' , $ show , $ post ) ) :
1044+
1045+ $ post_title = _draft_or_post_title ();
1046+
1047+ // If the post has no title, try adding part of the excerpt.
1048+ if ( 'excerpt ' !== $ mode && '' === get_the_title ( $ post ) && ! post_password_required ( $ post ) ) {
1049+ $ excerpt = get_the_excerpt ( $ post );
1050+ if ( '' !== $ excerpt && is_string ( $ excerpt ) ) {
1051+ $ post_title .= ' ' . esc_html ( wp_trim_words ( $ excerpt , 15 , ' … ' ) );
1052+ }
1053+ }
10401054 ?>
10411055 <input id="cb-select-<?php the_ID (); ?> " type="checkbox" name="post[]" value="<?php the_ID (); ?> " />
10421056 <label for="cb-select-<?php the_ID (); ?> ">
10431057 <span class="screen-reader-text">
10441058 <?php
10451059 /* translators: %s: Post title. */
1046- printf ( __ ( 'Select %s ' ), _draft_or_post_title () );
1060+ printf ( __ ( 'Select %s ' ), $ post_title );
10471061 ?>
10481062 </span>
10491063 </label>
@@ -1054,7 +1068,7 @@ public function column_cb( $item ) {
10541068 printf (
10551069 /* translators: Hidden accessibility text. %s: Post title. */
10561070 __ ( '“%s” is locked ' ),
1057- _draft_or_post_title ()
1071+ $ post_title
10581072 );
10591073 ?>
10601074 </span>
@@ -1142,6 +1156,14 @@ public function column_title( $post ) {
11421156
11431157 $ title = _draft_or_post_title ();
11441158
1159+ // If the post has no title, try adding part of the excerpt.
1160+ if ( 'excerpt ' !== $ mode && '' === get_the_title ( $ post ) && ! post_password_required ( $ post ) ) {
1161+ $ excerpt = get_the_excerpt ( $ post );
1162+ if ( '' !== $ excerpt && is_string ( $ excerpt ) ) {
1163+ $ title .= ' <span class="trimmed-post-excerpt"> ' . esc_html ( wp_trim_words ( $ excerpt , 15 , ' … ' ) ) . '</span> ' ;
1164+ }
1165+ }
1166+
11451167 if ( $ can_edit_post && 'trash ' !== $ post ->post_status ) {
11461168 printf (
11471169 '<a class="row-title" href="%s">%s%s</a> ' ,
0 commit comments