user9576028
user9576028

Reputation:

how get thumbnail size in PHP WordPress?

this is my php code and i want to add the size thumbnail max 300x420

<a class="blog-views" href="<?php the_permalink(); ?>"><?php
the_post_thumbnail('full'); ?></a>

i have get from wordpress this code, but this do not help me, thumbnail, medium, mdeium large, large and full.

the_post_thumbnail( 'thumbnail' );     // Thumbnail (150 x 150 hard cropped)
the_post_thumbnail( 'medium' );        // Medium resolution (300 x 300 max height 300px)
the_post_thumbnail( 'medium_large' );  // Medium Large (added in WP 4.4) resolution (768 x 0 infinite height)
the_post_thumbnail( 'large' );         // Large resolution (1024 x 1024 max height 1024px)
the_post_thumbnail( 'full' );          // Full resolution (original size uploaded)

Upvotes: 0

Views: 361

Answers (3)

Bhoomi
Bhoomi

Reputation: 537

Try to use this code:

the_post_thumbnail( array(300,420) );

Upvotes: 1

Priya
Priya

Reputation: 1470

You can change thumbnail size from admin side, wp-admin/options-media.php

Upvotes: 1

J.Dev
J.Dev

Reputation: 39

You can use set_post_thumbnail_size( 300, 420, true );

For more information follow this link set_post_thumbnail_size

Upvotes: 1

Related Questions