1

Can anybody can tell me how to give a particular image size to a image using the_post_thumbnail()?

I have also tried add_image_size( 'image', 270, 180 ); and Wordpress admin settings, but I'm not able to change the image size as I want. Is there any dynamic way to change the image size?

4

2 回答 2

1

You can use

      the_post_thumbnail('thumbnail'); 
      the_post_thumbnail('medium');        
      the_post_thumbnail('large');          
      the_post_thumbnail('full');           

      the_post_thumbnail( array(100,100) );
于 2013-07-22T11:13:17.147 回答
0

您可以使用上述任何一种方法,也可以使用 add_image_size 函数在您的主题函数文件中定义具有裁剪功能的新尺寸,请参阅http://codex.wordpress.org/Function_Reference/add_image_size。您可能对已上传的图像进行裁剪有问题,但在主题 functions.php 文件中添加图像大小后,您需要上传图像以相应地裁剪它们。

于 2013-07-22T11:29:08.840 回答