Get attachment image from media library

wp_get_attachment_image function can accept four values as you can see:

wp_get_attachment_image( int $attachment_id, string|array $size = 'thumbnail', bool $icon = false, string|array $attr = '' )

Examples

<?php echo wp_get_attachment_image( get_the_ID(), array('700', '600'), false, array( "class" => "img-fluid" ) ); ?>
<?php echo wp_get_attachment_image( 5151, 'medium', false, array( "class" => "img-fluid" ) ); ?>

Leave a Reply

Your email address will not be published. Required fields are marked *