Display height and width properties with the_post_thumbnail() or related function
You can collect image attributes using “wp_get_attachment_metadata“, see below example as starting point function mytheme_post_thumbnail( $size=”post-thumbnail”, $attr=””, $post_id = null ) { if ( has_post_thumbnail( $post_id ) ) { $meta = wp_get_attachment_metadata( get_post_thumbnail_id( $post_id ) ); $args[‘width’] = $meta[‘sizes’][$size][‘width’]; $args[‘height’] = $meta[‘sizes’][$size][‘height’]; $args[‘alt’] = isset( $attr[‘alt’] ) ? $attr[‘alt’] : apply_filters( ‘post_title’, get_post( $post_id )->post_title … Read more