Customizing the admin display

The final thing you can do to fully realize your new book custom-post-type is to change its display in the wp-admin panel. You don't need to know the WordPress user who created a given book, but you do want to see the book categories and the thumbnail. Let's go back to functions.php. First, we'll change the columns that are displayed, as shown in the following code:

function ahskk_custom_columns($defaults) { 
  global $wp_query, $pagenow; 
  if ($pagenow == 'edit.php') { 
    unset($defaults['author']); 
    unset($defaults['categories']); 
    unset($defaults['date']); 
    $defaults['book_category'] = 'Categories'; 
    $defaults['thumbnail'] = 'Image'; 
  } 
  return $defaults; 
} 
add_filter('manage_book_posts_columns', 'ahskk_custom_columns'); 
function ahskk_show_columns($name) { 
  global $post; 
  switch ($name) { 
    case 'book_category': 
      echo get_the_term_list($post->ID, 'book_category', '', ', ', ''); 
      break; 
    case 'thumbnail': 
      if (has_post_thumbnail($post->ID)) 
        echo get_the_post_thumbnail($post->ID, array('40', '40')); 
      break; 
  } 
} 
add_action('manage_book_posts_custom_column', 'ahskk_show_columns');

The first function says, don't show author, date, and categories, but do show book categories and thumbnail, and the second function says, for the book categories column, print the list of categories, and for the thumbnail column, print the get_post_thumbnail() function.

Revisit the Books page in the wp-admin panel, and it now looks like the following screenshot: