functions.phpに以下を追加
//アイキャッチをON add_theme_support( 'post-thumbnails' ); function manage_posts_columns($columns) { $columns['subtitle'] = "サブタイトル"; $columns['thumbnail'] = __('Thumbnail'); return $columns; } function add_column($column_name, $post_id) { //カスタムフィールド取得 if( $column_name == 'subtitle' ) { $stitle = get_post_meta($post_id, 'subtitle', true); } //アイキャッチ取得 if ( 'thumbnail' == $column_name) { $thum = get_the_post_thumbnail($post_id, array(50,50), 'thumbnail'); } //使用していない場合「なし」を表示 if ( isset($stitle) && $stitle ) { echo attribute_escape($stitle); } else if ( isset($thum) && $thum ) { echo $thum; } else { echo __('None'); } } add_filter( 'manage_posts_columns', 'manage_posts_columns' ); add_action( 'manage_posts_custom_column', 'add_column', 10, 2 );
ネタ元