php - WordPress get_the_post_thumbnail - get the custom size image? -
i have set featured image/ thumbnail 600x530 in functions.php:
if (function_exists('add_theme_support')) { add_theme_support('post-thumbnails'); set_post_thumbnail_size(600, 530, true); // default post thumbnail dimensions (cropped) }
but can't retrieve size via:
echo get_the_post_thumbnail($post->id, array(600, 530), array('class' => 'img-responsive'));
the image 169x300 or large un-cropped original size. want 600x530.
any ideas?
this explain here:
you can specify additional custom sizes! here’s code:
functions.php
add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 50, 50, true ); // normal post thumbnails add_image_size( 'single-post-thumbnail', 400, 9999 ); // permalink thumbnail size
home.php
or index.php
, depending on theme structure (in loop)
<?php the_post_thumbnail(); ?>
single.php
(in loop):
<?php the_post_thumbnail( 'single-post-thumbnail' ); ?>
Comments
Post a Comment