functions.phpに下記を記入
アイキャッチのサイズを設定
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | //投稿記事一覧にアイキャッチ画像を表示 function customize_admin_manage_posts_columns( $columns ) { $columns [ 'thumbnail' ] = __( 'Thumbnail' ); return $columns ; } function customize_admin_add_column( $column_name , $post_id ) { if ( 'thumbnail' == $column_name ) { //テーマで設定されているサムネイルを利用する場合 $thum = get_the_post_thumbnail( $post_id , 'thumb100' , array ( 'style' => 'width:75px;height:auto;' )); //Wordpressで設定されているサムネイル(小)を利用する場合 //$thum = get_the_post_thumbnail($post_id, 'small', array( 'style'=>'width:75px;height:auto;' )); } if ( isset( $thum ) && $thum ) { echo $thum ; } } //アイキャッチ画像の列の幅をCSSで調整 function customize_admin_css_list() { echo '<style TYPE="text/css">.column-thumbnail{width:60px;}</style>' ; } //カラムの挿入 add_filter( 'manage_posts_columns' , 'customize_admin_manage_posts_columns' ); //サムネイルの挿入 add_action( 'manage_posts_custom_column' , 'customize_admin_add_column' , 10, 2 ); //投稿一覧のカラムの幅のスタイル調整 add_action( 'admin_print_styles' , 'customize_admin_css_list' , 21); |