X

Updated: Add featured thumbnail to admin post / page columns

ColorMag Review - widget areas

This is an updated version of the posts thumbnail column snippet. Adding this snippet to the functions.php of your wordpress theme will add a new thumbnail column to your posts and pages admin columns.


Just a few updates to this including one courtesy of Cliff Paulick’s suggestion to check if post thumbnails are supportsed first to avoid errors. I also define a default image size and of course included both posts and pages in this snippet.

( example screenshot )


Code Snippet:


if (function_exists( 'add_theme_support' )){
add_filter('manage_posts_columns', 'posts_columns', 5);
add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2);
add_filter('manage_pages_columns', 'posts_columns', 5);
add_action('manage_pages_custom_column', 'posts_custom_columns', 5, 2);
}
function posts_columns($defaults){
$defaults['wps_post_thumbs'] = __('Thumbs');
return $defaults;
}
function posts_custom_columns($column_name, $id){
if($column_name === 'wps_post_thumbs'){
echo the_post_thumbnail( array(125,80) );
}
}

Comments  Leave a Reply

  1. That’s great! it worked with just copying and pasting that code sinppet on the functions.php file!
    Thank you!

  2. Wordpress Admin - How My Custom Posts List Rolls February 28, 2014 at 3:01 pm

    […] [Source] […]

  3. This is a pretty handy snippet, thanks for sharing.

    1. Cool glad you like the snippet,

  4. Thanks for the info. Any idea how to reorder the columns so the thumbnail column is first?
    thanks

    1. I’d also like the answer to that. At first I thought that it might be the “5” because it was in the fifth column but I tried changing it and nothing happened.

  5. Thanks for this handy tip. This really benefits our work process in viewing our wordpress posts.

    1.  Cool glad to see this helps out.

  6. I’d love to have this check if a featured image shows and work like it does, but if featured images aren’t enabled, display the post’s attached image’s thumbnail.  Would that be hard to do?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!