Fixing the width and height of the post thumbnail

I’m having trouble trying to set the width and height of my post thumbnail.

Here is the link for the image

As you can see both of the post have different dimensions

I have tried a couple of times in fixing the height and width of my post in fuction.php but no luck. Basically what i want to accomplish is that if i upload an image in the featured image regardless of size it would come out with a height of 250px and a width of 250 px. But whatever i do it seems incorrect.

This is the code that i have encoded


 <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>


//post thumbnail support 3

 add_theme_support( 'post-thumbnails', array( 'post' ) );
 set_post_thumbnail_size( 250, 250 );

Am i missing something? I’m still trying to code in wordpress and PHP language. Basically i’m still a newbie. I really want to accomplish this without having to really on plugins

You can set the width and height either in the HTML and/or in the CSS.


<img src="" width="250" height="250" alt="">


.post img {width: 250px; height: 250px;}