admin管理员组文章数量:1404923
The theme has set thumbnail sizes for featured images:
add_theme_support( 'post-thumbnails' );
add_image_size( 'hitmag-landscape', 1120, 450, true );
add_image_size( 'hitmag-featured', 735, 400, true );
add_image_size( 'hitmag-grid', 348, 215, true );
add_image_size( 'hitmag-list', 290, 220, true );
add_image_size( 'hitmag-thumbnail', 135, 93, true );
How do I set the "featured" image one so that the image size is just whatever image I upload (for height - I want to be able to set width to 735 still)
The theme has set thumbnail sizes for featured images:
add_theme_support( 'post-thumbnails' );
add_image_size( 'hitmag-landscape', 1120, 450, true );
add_image_size( 'hitmag-featured', 735, 400, true );
add_image_size( 'hitmag-grid', 348, 215, true );
add_image_size( 'hitmag-list', 290, 220, true );
add_image_size( 'hitmag-thumbnail', 135, 93, true );
How do I set the "featured" image one so that the image size is just whatever image I upload (for height - I want to be able to set width to 735 still)
Share Improve this question edited Jan 8, 2019 at 23:29 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Jan 8, 2019 at 17:52 MantaRayMantaRay 254 bronze badges 1- If u dont want to crop image than you can change true to false in this line add_image_size( 'hitmag-featured', 735, 400, true ); – Pratik Patel Commented Jan 8, 2019 at 18:04
1 Answer
Reset to default 1Featured image sizes are mostly likely controlled by your theme, so I would look there. Maybe there is a theme setting for it.
You can also check the following setting to see if it us using one of those sizes.
You can change the featured image size by adding this code into your functions.php file. More info on set_post_thumbnail_size.
set_post_thumbnail_size( 500, 500 );
You can also add a new image size and then use it in your template by doing something like this...
add_image_size( 'featured-image-size', 800, 9999 ); // Add to functions.php
php the_post_thumbnail( 'featured-image-size' ); // Template usage
More info on add_image_size & the_post_thumbnail
Edit: Since you updated your question, here is an updated answer.
You can set the height to be unlimited like this...
add_image_size( 'hitmag-featured', 735, 9999 );
本文标签: How to prevent resized featured images
版权声明:本文标题:How to prevent resized featured images? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744872440a2629710.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论