Created
March 27, 2019 09:42
-
-
Save zartgesotten/0aff0c6044bcd2c4cc7e8a4299cc7aba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_image_size( 'admin-list-thumb', 80, 80, false ); | |
| // add featured thumbnail to admin post columns | |
| function wpcs_add_thumbnail_columns( $columns ) { | |
| $columns = array( | |
| 'cb' => '<input type="checkbox" />', | |
| 'featured_thumb' => 'Thumbnail', | |
| 'title' => 'Title', | |
| 'author' => 'Author', | |
| 'categories' => 'Categories', | |
| 'tags' => 'Tags', | |
| 'comments' => '<span class="vers"><div title="Comments" class="comment-grey-bubble"></div></span>', | |
| 'date' => 'Date' | |
| ); | |
| return $columns; | |
| } | |
| function wpcs_add_thumbnail_columns_data( $column, $post_id ) { | |
| switch ( $column ) { | |
| case 'featured_thumb': | |
| echo '<a href="' . get_edit_post_link() . '">'; | |
| echo the_post_thumbnail( 'admin-list-thumb' ); | |
| echo '</a>'; | |
| break; | |
| } | |
| } | |
| if ( function_exists( 'add_theme_support' ) ) { | |
| add_filter( 'manage_posts_columns' , 'wpcs_add_thumbnail_columns' ); | |
| add_action( 'manage_posts_custom_column' , 'wpcs_add_thumbnail_columns_data', 10, 2 ); | |
| add_filter( 'manage_pages_columns' , 'wpcs_add_thumbnail_columns' ); | |
| add_action( 'manage_pages_custom_column' , 'wpcs_add_thumbnail_columns_data', 10, 2 ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment