Return to Snippet

Revision: 53658
at November 30, 2011 21:22 by f6design

Initial Code
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' ); 

if ($image) : ?>
    <img src="<?php echo $image[0]; ?>" alt="" />
<?php endif; ?>

Initial URL

Initial Description
This is an example of omitting the width and height attributes from a thumbnail img tag in Wordpress. Useful if you are working on a responsive design. Use inside The Loop.

Initial Title
Wordpress: Omit width/height attributes from img tag

Initial Tags
wordpress, images

Initial Language