WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am just about finished creating custom columns through the WordPress admin panel.

The custom post type I am using is called "slides". I figured out how to add the column titles and all of the column content (because they're WordPress defaults)...what I am missing is how do I add content to the "thumbnail" column? Some kind of if statement like: if admin-thumbnail exists display the admin-thumbnail image...which sounds simple enough, I just don't know how to add it to that specific column.

The code I have so far is: http://pastebin.com/YfuYUW5c.

Thanks, Josh

share|improve this question

first create the new column:

add_filter( 'manage_edit-post_columns', 'c3m_new_column');
function c3m_new_column( $defaults ) {
    $dfaults['post_thumbnail'] = 'Post Thumbnail';
    return $defaults;

Now the function to output the thumbnails in the column:

add_action( 'manage_posts_custom_column', 'c3m_custom_column', 10, 2);
function c3m_custom_column( $column_name, $post_id ) {
    if ($column_name == 'post_thumbnail') {
        if ( has_post_thumbnail() ) {
            $img_url = wp_get_attachment_image_src( get_post_thumbnail_id() );
            echo '<img src="'. esc_url( $img_url[0] ).'" />';
        } else { echo 'No Post Thumbnail Set'; }
share|improve this answer
Do you need the global $post; in c3m_custom_column? – westondeboer Jul 3 '12 at 4:11
no, you do not need , also, you can simply use the_post_thumbnail( array(100,100) ) //or other size .. instead of $img_URL array .. – krembo99 Jul 3 '12 at 4:14
up vote 1 down vote accepted


I modified the following (and the code is working!): http://pastebin.com/HZWgHrZf.

I got it here: http://justintadlock.com/archives/2011/06/27/custom-columns-for-custom-post-types

For every column you simply add another case :)

Thanks, Josh

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.