Edit:
I want to show thumbnail with custom size.So, I mean scale the thumbnails to avoid load heavy size to browser.I couldnt do it.
Here is my code in my plugin:
<img class="img-responsive img-whp" style="width: 368px;" src="<?php the_post_thumbnail_url(array(450, 450, true)); ?>" alt="1.jpg">
here is the thumbnail size in my theme function.php:
// Add Thumbnail Theme Support
add_theme_support(‘post-thumbnails’);
add_image_size( ‘team-slider-thumbnail’, 450, 450, true);
Old Question:
I have below code to show thumbnail on archive page:
<?php
if ( $thumbnail_id = get_post_thumbnail_id() ) {
if ( $image_src = wp_get_attachment_image_src( $thumbnail_id, 'normal-bg' ) )
?>
<div class="col-md-12 ulockd-mrgn1210">
<div class="ulockd-project-sm-thumb">
<img class="img-responsive img-whp" src="<?php printf( '%s', esc_url($image_src[0]) ); ?>" alt="">
</div>
</div>
there is no normal-bg
size in function.php but the thumbnai image size is: 90x100
also there is no 90x100
in wp admin panel.here is admin panel size:
Image sizes
The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.
Thumbnail size Thumbnail sizeWidth
150
Height
150
Crop thumbnail to exact dimensions (normally thumbnails are proportional)
Medium size Medium sizeMax Width
300
Max Height
300
Large size Large sizeMax Width
1024
Max Height
1024
When I changed the normal-bg
to recognized size in function.php, for example, to custom-size
, it doesnt change.
here is my code in function.php:
if (function_exists('add_theme_support'))
{
add_theme_support( 'custom-logo' );
// Add Menu Support
add_theme_support('menus');
// Add Thumbnail Theme Support
add_theme_support('post-thumbnails');
add_image_size('large', 700, '', true); // Large Thumbnail
add_image_size('medium', 250, '', true); // Medium Thumbnail
add_image_size('small', 120, '', true); // Small Thumbnail
add_image_size('custom-size', 700, 200, true); // Custom Thumbnail Size call using the_post_thumbnail('custom-size');
so, how can I change the thumbnail size to what I want, for example, to custom-size
or medium
?