Display Featured Images In Admin Post List

When it comes to photography sites built on WordPress, there really is one common thing that nearly all of them have. Photos. And while I recommend having a good title, both for attracting readers and for SEO reasons, sometimes it’s easier to recall what your post was about by seeing the featured image you used to represent the post.

So let’s imagine you’re looking back through your posts and want to edit something. You could just browse the site itself so you can see the images, find the post you want to edit, remember the title, go back to the post list in the admin interface and go through the pages of posts until you find that title. Wouldn’t it be easier if you could see the featured post image in the list of posts?

Featured Images in Post List

This adds a thumbnail display of each posts featured image.

Just copy this bit of PHP and put it in the bottom of your functions.php file in your theme.

// Setup Admin Thumbnail Size
if ( function_exists( 'add_theme_support' ) ) {
  add_image_size( 'admin-thumb', 100, 999999 ); // 100 pixels wide (and unlimited height)
	}

// Thumbnails to Admin Post View
add_filter('manage_posts_columns', 'posts_columns', 5);
add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2);

function posts_columns($defaults){
    $defaults['my_post_thumbs'] = __('Thumbs');
    return $defaults;
}

function posts_custom_columns($column_name, $id){
	if($column_name === 'my_post_thumbs'){
        echo the_post_thumbnail( 'admin-thumb' );
    }
}

Without any changes this should add a new column to your post list. If things seem to be getting a little crowded in your columns, you can hide some of the columns by de-selecting the ones you don’t need to see all the time on the drop-down menu labeled Screen Options.

This is a really simple trick, but one that goes a long way to making the post list interface feel much more useable. Let me know how yours turned out or if you’ve got any questions.

This article has 4 comments

  1. Judy

    Thanks so much for this! I am setting up a site at the moment and needed just this to manage my photos more easily. It literally took me a minute to do and it worked like a charm.

  2. Pingback: Display Featured Images In WordPress Admin Post List | New York Freelance Web Designer Blog | Streetcar Productions

  3. Rai

    When I use this code it brings my products post from woocommerce to my custom post type list. Any idea to solve it?, thanks.