Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* DISPLAY POST THUMB ON EDIT POSTS SCREEN */
- if(!function_exists('displayThumbsColumn') && function_exists('add_theme_support')) {
- function addThumbsColumn($cols) {
- $cols['thumbnail'] = __('Post thumbnail');
- return $cols;
- }
- function displayThumbsColumn($column_name, $post_id) {
- switch($column_name) {
- case 'thumbnail' :
- $thumb = get_post_meta($post_id, '_thumbnail_id', true);
- if (empty($thumb)) break;
- else echo wp_get_attachment_image($thumb, 'thumbnail');
- break;
- default :
- break;
- }
- }
- // display on posts edit screen
- add_filter( 'manage_posts_columns', 'addThumbsColumn' );
- add_action( 'manage_posts_custom_column', 'displayThumbsColumn', 10, 2 );
- // display on custom post type (named "my_custom_post_type" for clarity...) edit screen
- add_filter( 'manage_edit-my_custom_post_type_columns', 'addThumbsColumn' );
- add_action( 'manage_my_custom_post_type_posts_custom_column', 'displayThumbsColumn', 10, 2 );
- }
Add Comment
Please, Sign In to add comment