Created
March 5, 2020 15:41
-
-
Save spacedmonkey/5d080de3711c6964f2d9c92108102523 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'get_image_tag', function( $html, $id, $alt, $title, $align, $size ){ | |
$original_url = $this->get_original_url( $id ); | |
if ( ! $original_url ) { | |
return $html; | |
} | |
list( $img_src, $width, $height ) = image_downsize( $id, $size ); | |
$hwstring = image_hwstring( $width, $height ); | |
$html = '<img src="' . $img_src . '" alt="' . esc_attr( $alt ) . '" ' . $title . $hwstring . 'class="' . $class . '" />'; | |
return $html; | |
}); |
pierlon
commented
Mar 5, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment