From d766856878f6a917eda528d7d08bb4228402a788 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 1 Apr 2017 14:07:01 +0000 Subject: [PATCH] Posts, Post Types: Introduce `post_date_column_status` filter for post status text in list tables' Date column. Props pbearne. Fixes #39545. git-svn-id: https://develop.svn.wordpress.org/trunk@40361 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-posts-list-table.php | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) 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 e03474ad51..9881c51889 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -993,17 +993,33 @@ class WP_Posts_List_Table extends WP_List_Table { } if ( 'publish' === $post->post_status ) { - _e( 'Published' ); + $status = __( 'Published' ); } elseif ( 'future' === $post->post_status ) { if ( $time_diff > 0 ) { - echo '' . __( 'Missed schedule' ) . ''; + $status = '' . __( 'Missed schedule' ) . ''; } else { - _e( 'Scheduled' ); + $status = __( 'Scheduled' ); } } else { - _e( 'Last Modified' ); + $status = __( 'Last Modified' ); } - echo '
'; + + /** + * Filters the status text of the post. + * + * @since 4.8.0 + * + * @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'). + */ + $status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode ); + + if ( $status ) { + echo $status . '
'; + } + if ( 'excerpt' === $mode ) { /** * Filters the published time of the post.