开发者

Wordpress Plugin or quick php function for conditional image size

开发者 https://www.devze.com 2022-12-20 19:24 出处:网络
my index.php has a body column width of about 400px The single.php has a column width of about 550px Is there a plugin or quick way to make all images (not just the post_thumbnail)

my index.php has a body column width of about 400px

The single.php has a column width of about 550px

Is there a plugin or quick way to make all images (not just the post_thumbnail) display at full size (i.e., image.jpg) on single.php but use the thumbnail size (i.e., image-350x***.jpg) 开发者_如何学JAVAon index.php?


Dont really know how you are showing you images, but try something like...

On single.php:

$img = wp_get_attachment_image($attachment_id, $size='full', $icon = false);
echo $img;

And on index.php:

$img = wp_get_attachment_image($attachment_id, $size=array(350,250), $icon = false);
echo $img;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号