Question

i am trying to create my first wordpress theme and i came now to a problem i can't seem to solve.

Due to the design of the theme, i would like to have featured images on every post, but they would need to be all the same size. On my functions.php i have enabled the feature images, set a size and even tried to add custom size, but nothing is working as i wanted. My code looks like this:

function.php:

add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 200,200, true);
add_image_size( 'feat', 200, 200, true );

then on my content.php:

<?php the_post_thumbnail('feat'); ?>

The images resize, but they don't crop. It makes the bigger side of the image equal to 200, but still keeps the original aspect ration.

Any ideas of what i'm doing wrong?

Was it helpful?

Solution

Maybe it happens because you had added add_image_size before you uploaded your images. Try to delete and upload images again or download Regenerate Thumbnails plugin and regenerate all your images in media library.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top