| 1 | diff --git wp-admin/admin-ajax.php wp-admin/admin-ajax.php |
|---|
| 2 | index d2a8d4d..66f03f4 100644 |
|---|
| 3 | --- wp-admin/admin-ajax.php |
|---|
| 4 | +++ wp-admin/admin-ajax.php |
|---|
| 5 | @@ -1036,8 +1036,14 @@ case 'hidden-columns' : |
|---|
| 6 | if ( ! $user = wp_get_current_user() ) |
|---|
| 7 | die('-1'); |
|---|
| 8 | |
|---|
| 9 | + set_current_screen( $page ); |
|---|
| 10 | + $screen = get_current_screen(); |
|---|
| 11 | if ( is_array($hidden) ) |
|---|
| 12 | update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true); |
|---|
| 13 | + |
|---|
| 14 | + // show post format column if it's not found in $hidden |
|---|
| 15 | + if ( $screen->base == 'edit' && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) && ! in_array( 'format', $hidden ) && ! get_user_option( "{$screen->id}postformatsshown" ) ) |
|---|
| 16 | + update_user_option( $user->ID, "{$screen->id}postformatsshown", 1 ); |
|---|
| 17 | |
|---|
| 18 | die('1'); |
|---|
| 19 | break; |
|---|
| 20 | diff --git wp-admin/includes/class-wp-posts-list-table.php wp-admin/includes/class-wp-posts-list-table.php |
|---|
| 21 | index e623ab5..72388e3 100644 |
|---|
| 22 | --- wp-admin/includes/class-wp-posts-list-table.php |
|---|
| 23 | +++ wp-admin/includes/class-wp-posts-list-table.php |
|---|
| 24 | @@ -272,6 +272,9 @@ class WP_Posts_List_Table extends WP_List_Table { |
|---|
| 25 | |
|---|
| 26 | if ( post_type_supports( $post_type, 'author' ) ) |
|---|
| 27 | $posts_columns['author'] = __( 'Author' ); |
|---|
| 28 | + |
|---|
| 29 | + if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) |
|---|
| 30 | + $posts_columns['format'] = _x( 'Format', 'post format' ); |
|---|
| 31 | |
|---|
| 32 | if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) ) |
|---|
| 33 | $posts_columns['categories'] = __( 'Categories' ); |
|---|
| 34 | @@ -663,6 +666,15 @@ class WP_Posts_List_Table extends WP_List_Table { |
|---|
| 35 | ?></td> |
|---|
| 36 | <?php |
|---|
| 37 | break; |
|---|
| 38 | + |
|---|
| 39 | + case 'format': |
|---|
| 40 | + ?> |
|---|
| 41 | + <td <?php echo $attributes ?>><?php |
|---|
| 42 | + if ( get_post_format( $post->ID ) ) |
|---|
| 43 | + echo get_post_format_string( get_post_format( $post->ID ) ); |
|---|
| 44 | + ?></td> |
|---|
| 45 | + <?php |
|---|
| 46 | + break; |
|---|
| 47 | |
|---|
| 48 | default: |
|---|
| 49 | ?> |
|---|
| 50 | diff --git wp-admin/includes/template.php wp-admin/includes/template.php |
|---|
| 51 | index b345c36..ad455f4 100644 |
|---|
| 52 | --- wp-admin/includes/template.php |
|---|
| 53 | +++ wp-admin/includes/template.php |
|---|
| 54 | @@ -254,7 +254,13 @@ function get_hidden_columns( $screen ) { |
|---|
| 55 | if ( is_string( $screen ) ) |
|---|
| 56 | $screen = convert_to_screen( $screen ); |
|---|
| 57 | |
|---|
| 58 | - return (array) get_user_option( 'manage' . $screen->id . 'columnshidden' ); |
|---|
| 59 | + $hidden = (array) get_user_option( 'manage' . $screen->id . 'columnshidden' ); |
|---|
| 60 | + |
|---|
| 61 | + // post format column is hidden by default |
|---|
| 62 | + if ( $screen->base == 'edit' && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) && ! in_array( 'format', $hidden ) && ! get_user_option( "{$screen->id}postformatsshown" ) ) |
|---|
| 63 | + $hidden[] = 'format'; |
|---|
| 64 | + |
|---|
| 65 | + return $hidden; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | // adds hidden fields with the data for use in the inline editor for posts and pages |
|---|
| 69 | @@ -1646,9 +1652,6 @@ function _post_states($post) { |
|---|
| 70 | echo "<span class='post-state'>$state$sep</span>"; |
|---|
| 71 | } |
|---|
| 72 | } |
|---|
| 73 | - |
|---|
| 74 | - if ( get_post_format( $post->ID ) ) |
|---|
| 75 | - echo ' - <span class="post-state-format">' . get_post_format_string( get_post_format( $post->ID ) ) . '</span>'; |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | /** |
|---|