I need to add width="100%"
and class="img-responsive"
.
How do I add to the img if I call it in the index this way?
<?php the_post_thumbnail(); ?>
I need to add width="100%"
and class="img-responsive"
.
How do I add to the img if I call it in the index this way?
<?php the_post_thumbnail(); ?>
Do this:
<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);
echo "<img src='".$thumb_url[0]."' width='100%' class='img-responsive' />";
?>
get_post_thumbnail_id
takes the id of the thumb.
wp_get_attachment_image_src
takes the url of the image, passing the id of the thumb as a parameter.