Customize the information that is displayed on the ‘posts’ page
Adding a column labeled “Thumbnail” (and delete the “Comments” column).
add_filter( 'manage_edit-post_columns', 'set_columns' ); function set_columns($columns) { $columns['thumbnail'] = 'Thumbnail'; unset( $columns['comments'] ); return $columns; }
Now we need to tell WordPress what to do with this new “Thumbnail” space. Here, we’re checking for the existence of a featured image and displaying it, or noting that there is no thumbnail.
add_action( 'manage_posts_custom_column', 'fill_columns' ); function fill_columns($column) { global $post; switch($column) { case 'thumbnail' : if (has_post_thumbnail($post->ID)) echo get_the_post_thumbnail($post->ID, array(50, 50)); else echo '<em>no thumbnail</em>'; break; } }
Thanks for the post – exactly what I was looking for.
I used this for a custom post type, so instead of
manage_posts_custom_column
I used
manage_{$post_type}_posts_custom_column