最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - Custom image sizes ignored in WP 3.5

programmeradmin10浏览0评论

Since migrating to WP 3.5 I discovered that my custom image sizes get ignored - whenever I try and output one of them WP just defaults to the original image instead. Kind of frustrating... Any idea where to start?

functions.php -

add_theme_support( 'post-thumbnails' ); 
add_image_size( 's', 145, 999 );
add_image_size( 'm', 300, 999 );
add_image_size( 'l', 455, 999 );
add_image_size( 'tablet', 1024, 9999 );
add_image_size( 'browser', 1920, 9999 );

The original media sizes in WP admin is set to 0x0. Also tried reseting these in case WP chose to disable image sizes altogether for some reason.

index.php -

// Inside the loop
$size = 's';
$image = wp_get_attachment_image_src(get_field('thumbnail'), $size);
echo $image[0];

The field 'thumbnail' is a custom field I've created. It stores the ID of the attachment.

Edit: This seems to be a bug

Since migrating to WP 3.5 I discovered that my custom image sizes get ignored - whenever I try and output one of them WP just defaults to the original image instead. Kind of frustrating... Any idea where to start?

functions.php -

add_theme_support( 'post-thumbnails' ); 
add_image_size( 's', 145, 999 );
add_image_size( 'm', 300, 999 );
add_image_size( 'l', 455, 999 );
add_image_size( 'tablet', 1024, 9999 );
add_image_size( 'browser', 1920, 9999 );

The original media sizes in WP admin is set to 0x0. Also tried reseting these in case WP chose to disable image sizes altogether for some reason.

index.php -

// Inside the loop
$size = 's';
$image = wp_get_attachment_image_src(get_field('thumbnail'), $size);
echo $image[0];

The field 'thumbnail' is a custom field I've created. It stores the ID of the attachment.

Edit: This seems to be a bug
http://core.trac.wordpress/ticket/22985

Share Improve this question edited Mar 8, 2013 at 10:08 Staffan Estberg asked Mar 8, 2013 at 9:46 Staffan EstbergStaffan Estberg 3833 gold badges13 silver badges29 bronze badges 1
  • the bug u attached is marked fixed. Whats inside this? get_field('thumbnail') - can u print it? are u sure ur getting an id? – Sagive Commented Mar 27, 2020 at 11:58
Add a comment  | 

1 Answer 1

Reset to default 0

Try regenerating images for each sizes by using this plugin.

发布评论

评论列表(0)

  1. 暂无评论