Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress Post Thumbnail Problem

I have two types of posts in the theme I am creating Trending and Normal. Post thumbnail image size is: 300x169 and I show it as that size when a trending post is displayed. But when this post is not trending I want the thumbnail size to be: 145x80. I tried the_post_thumbnail( array(145,80) ); but it doesn't work. Instead this crops the image in squarish dimensions. I don't want it to crop but decrease in size via HTML.

Can anyone please help me with this.

Thanks! Appreciate all the help.

like image 916
Aayush Avatar asked Dec 28 '25 21:12

Aayush


1 Answers

You could try adding a new image size and then when you call the_post_thumbnail you pass it the name of the new image size you have set. Set the hardcrop flag to false if you don't wan't the image resizing via hard crop.

http://codex.wordpress.org/Function_Reference/add_image_size

like image 156
Ben Avatar answered Dec 30 '25 13:12

Ben



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!