Thumbnails of same size with different crop

You can define your own cropping sizes but you can create a function that accepts image size + image position and then load your images accordingly. For example- <?php $size=”medium”; $pos = array( ‘top’ => ‘100’, ‘left’ => ‘100’ ); function load_image_with_pos( $img_id, $size, $pos ) { $img_src = wp_get_attachment_image_src( $img_id, $size ); $new_img = … Read more

Is there a hook which fires after all thumbnails are generated?

Thumbnails in WordPress can be generated by using wp_generate_attachment_metadata(), this function fires a filter after generating all the thumbnails wp_generate_attachment_metadata and the filter provides $metadata and $attachment_id to the hooked functions. You can hook your custom function to this filter. $metadata : Attachment metadata. What you need is $metadata[‘sizes’][‘<size-name>’], the <size-name> is the name of … Read more

New image size version only for the Featured Image file

Research The question Filter For Featured Image lead to this answer: How to hook update_post_meta and delete_post_meta?. Coupled with the a fine global variable ($_wp_additional_image_sizes) revealed here: How to get a list of all the possible thumbnail sizes set within a theme, bring us to the code that catches the “Use as featured image” action … Read more

the_post_thumbnail responsive srcset not populating with custom image size

There’s not enough info to be sure this answer is definitive but here’s an attempt. Firstly make sure the image you are uploading is actually larger than the size you have defined. I see people upload images that are too small and then get this sort of result all the time. Secondly, WP will only … Read more

How to set thumbnail image for a (child) theme

Create image file in PNG Format having name screenshot.png and save it in themes root folder.The recommended image size is 880×660. Even recommended image size is 880×660 though it will only be shown as 387×290 but the double-sized image allows for high-resolution viewing on HiDPI displays. For more information see this page. If you don’t … Read more