我正在寻找一种方法来避免在 CPT 中上传新图像时创建图像缩略图。
所以在我的functions.php中我有:
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 56, 56, true ); // Normal post thumbnails
add_image_size( 'tinyfeatured', 50, 50, true ); // Tiny Featured thumbnail
add_image_size( 'blogonecol', 530, '', true ); // Blog One Column thumbnail
add_image_size( 'post', 530, '', true ); // Portfolio Large thumbnail
add_image_size( 'postnc', 700, '', false ); // Portfolio Large thumbnail
add_image_size( 'carousel', 560, 341, true ); // Portfolio Large thumbnail
add_image_size( 'magazine-full', '', 1131, true); // Portfolio Large thumbnail
}
为了避免为我正在使用的 CPT 创建所有这些图像尺寸,我这样做了:
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
if( !is_singular('issues') ) {
set_post_thumbnail_size( 56, 56, true ); // Normal post thumbnails
add_image_size( 'tinyfeatured', 50, 50, true ); // Tiny Featured thumbnail
add_image_size( 'blogonecol', 530, '', true ); // Blog One Column thumbnail
add_image_size( 'post', 530, '', true ); // Portfolio Large thumbnail
add_image_size( 'postnc', 700, '', false ); // Portfolio Large thumbnail
add_image_size( 'carousel', 560, 341, true ); // Portfolio Large thumbnail
}
add_image_size( 'magazine-full', '', 1131, true); // Portfolio Large thumbnail
}
但是,当我在 CPT“问题”中上传新图像时,会创建上述所有图像大小。
还有其他方法可以避免这种情况吗?