I’ve added the following code to my theme’s functions.php
file:
function add_custom_sizes() { add_image_size('featured-thumbnail', 690, 500, true); add_image_size('secondary-thumbnail', 460, 236, true); add_image_size('related-thumbnail', 360, 262, true); add_image_size('true-thumbnail', 337, 209, true); add_image_size('search-thumbnail', 208, 130, true); } add_action('after_setup_theme', add_custom_sizes);
Within my template I have code such as:
<?php if (has_post_thumbnail() ) { the_post_thumbnail('featured-thumbnail'); } else { ?> <img src="http://via.placeholder.com/690x500" alt=""> <?php } ?>
And this is the image it outputs:
<img width="690" height="407" src="https://s3.amazonaws.com/.../image-2440x1440.jpg" class="attachment-featured-thumbnail size-featured-thumbnail wp-post-image" alt="" />
The original size of the image is 2440px x 1440px so I don’t understand why it’s not respecting my height category. It’s a brand new image that’s been uploaded, but just to double check I’ve regenerated my thumbnails but the problem persists. I’m at a complete loss. I literally just banged my head against my desk.