Guide to wordpress custom post thumbnail sizes


if (function_exists("add_theme_support")) add_theme_support("post-thumbnails"); set_post_thumbnail_size(600, 530, true); // mặc định Post Thumbnail dimensions (cropped)But I can"t retrieve sầu that size via:

eđến get_the_post_thumbnail($post->ID, array(600, 530), array("class" => "img-responsive"));The image I always get is 169x300 or the large un-cropped original size. But I want 600x530.

Any ideas?

Bạn đang xem: Guide to wordpress custom post thumbnail sizes


This explain it Here:

You can specify additional custom sizes! Here’s the code:


add_theme_support( "post-thumbnails" );set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnailsadd_image_size( "single-post-thumbnail", 400, 9999 ); // Permalinks thumbnail sizehome.php or index.php, depending on your theme structure (in the loop)

single.php (in the loop):


I think this is the answer:

Wordpress Custom Featured image size?

if ( function_exists( "add_theme_support" ) ) add_theme_support( "homepage-thumb" ); set_post_thumbnail_size( 4đôi mươi, 110 ); // mặc định Post Thumbnail dimensions if ( function_exists( "add_image_size" ) ) add_image_size( "homepage-thumb",420, 110, true ); //(cropped)instead of:

get_the_post_thumbnail($post->ID, array(4đôi mươi,110) );Use:

get_the_post_thumbnail($post->ID, "homepage-thumb" );


Xem thêm: Lỗi Không Vào Được Google Chrome, Chia Sẻ Cách Sửa Lỗi Không Mở Được Google Chrome


Thanks for contributing an answer to lớn Staông xã Overflow!

Please be sure lớn answer the question. Provide details & tóm tắt your research!

But avoid

Asking for help, clarification, or responding to lớn other answers.Making statements based on opinion; baông xã them up with references or personal experience.

To learn more, see our tips on writing great answers.

Post Your Answer Disthẻ

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged php wordpress or ask your own question.


site kiến thiết / logo © 2021 Staông chồng Exchange Inc; web1_user contributions licensed under cc by-sa. rev2021.5.14.39303

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device & discđại bại information in accordance with our Cookie Policy.