この記事は、Raindrops1.336以降で利用できます。
functions.phpにコードを追加します。
<?php add_image_size( 'archive_featured_icon', 100, 50, true );// 100は幅(px) 50は高さ(px) add_filter('raindrops_post_thumbnail_size_main_query','my_post_thumbnail_size_custom' ); add_filter('raindrops_embed_meta_css', 'my_archive_thumbnail_size_custom_style' ); function my_post_thumbnail_size_custom( $size ) { return 'archive_featured_icon'; } function my_archive_thumbnail_size_custom_style( $css ) { $image_size= my_get_image_sizes('archive_featured_icon'); $custom_style= '.tag .h2-thumb, .category .h2-thumb, .rd-featured-no-front .h2-thumb, .rd-featured-no-left .h2-thumb,.rd-featured-no-front .h2-thumb, .rd-featured-no-left .h2-thumb{ width: '.absint( $image_size ['width'] ).'px; } .tag .h2-thumb .wp-post-image,.category .h2-thumb .wp-post-image, .rd-featured-no-front .h2-thumb .wp-post-image, .rd-featured-no-left .h2-thumb .wp-post-image,.paged .h2-thumb .wp-post-image, .paged .h2-thumb .wp-post-image{ width:'.absint( $image_size ['width'] ).'px; }'; return $css. $custom_style; } function my_get_image_sizes( $size= '' ) { /* @see https://codex.wordpress.org/Function_Reference/get_intermediate_image_sizes */ global $_wp_additional_image_sizes; $sizes= array(); $get_intermediate_image_sizes= get_intermediate_image_sizes(); // Create the full array with sizes and crop info foreach( $get_intermediate_image_sizes as $_size ) { if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) { $sizes[ $_size ]['width']= get_option( $_size . '_size_w' ); $sizes[ $_size ]['height']= get_option( $_size . '_size_h' ); $sizes[ $_size ]['crop']= (bool) get_option( $_size . '_crop' ); } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { $sizes[ $_size ]= array( 'width'=> $_wp_additional_image_sizes[ $_size ]['width'], 'height'=> $_wp_additional_image_sizes[ $_size ]['height'], 'crop'=> $_wp_additional_image_sizes[ $_size ]['crop'] ); } } if ( $size ) { if( isset( $sizes[ $size ] ) ) { return $sizes[ $size ]; } else { return false; } } return $sizes; } ?>