Skip to content

Commit

Permalink
Remove slug and status columns (#35996)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskoster authored Nov 5, 2021
1 parent eb6f8cb commit 2599d51
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions lib/full-site-editing/templates-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
* @return array Filtered $columns.
*/
function gutenberg_templates_lists_custom_columns( array $columns ) {
$columns['slug'] = __( 'Slug', 'gutenberg' );
$columns['description'] = __( 'Description', 'gutenberg' );
$columns['status'] = __( 'Status', 'gutenberg' );
$columns['theme'] = __( 'Theme', 'gutenberg' );
if ( isset( $columns['date'] ) ) {
unset( $columns['date'] );
Expand All @@ -29,29 +27,11 @@ function gutenberg_templates_lists_custom_columns( array $columns ) {
* @param int $post_id Post ID.
*/
function gutenberg_render_templates_lists_custom_column( $column_name, $post_id ) {
if ( 'slug' === $column_name ) {
$post = get_post( $post_id );
echo esc_html( $post->post_name );
return;
}

if ( 'description' === $column_name && has_excerpt( $post_id ) ) {
the_excerpt( $post_id );
return;
}

if ( 'status' === $column_name ) {
$post_status = get_post_status( $post_id );
// The auto-draft status doesn't have localized labels.
if ( 'auto-draft' === $post_status ) {
echo esc_html_x( 'Auto-Draft', 'Post status', 'gutenberg' );
return;
}
$post_status_object = get_post_status_object( $post_status );
echo esc_html( $post_status_object->label );
return;
}

if ( 'theme' === $column_name ) {
$terms = get_the_terms( $post_id, 'wp_theme' );
if ( empty( $terms ) || is_wp_error( $terms ) ) {
Expand Down

0 comments on commit 2599d51

Please sign in to comment.