0

I'm a little bit lost right now. I'm developing my first Genesis child theme and I want to change the entries on the archive pages. I've found that WordPress offers a way of cropping images so I added this image size to my functions.php:

add_image_size( 'archive_image_size', 880, 300, TRUE );

In the archive.php I'm using the code like this:

/** Add the featured image */
add_action( 'genesis_entry_header' , 'featured_image_background_with_comments', 4);

function featured_image_background_with_comments() {
<div class="featured-archive-image">
    <?php the_post_thumbnail( 'archive_image_size' ); ?>
    <a href="<?php comments_link(); ?>"><?php comments_number('No comments', '1 Comment', '% Comments'); ?></a>
</div>
<?php 
}

My expected result is: Width: 880px, Height: 300px, width is shown 100%, height is cropped (as the image is 2500 × 1407).

Actual result: Width: 533px, Height: 300px, image is resized instead of cropped

Is there any mistake in my code or does this come from something else?

0

Try uploading a new image and seeing your code work. The issue is that cropping does not work retroactively - so it does not affect old images. There is a plugin - I haven't tried it, but it comes recommended - to update the older images to fit your new image sizes: http://wordpress.org/extend/plugins/regenerate-thumbnails/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.