[wp-hackers] the_post_thumbnail 'full' with no width/height attr
John Blackbourn
johnbillion+wp at gmail.com
Tue Feb 15 17:42:50 UTC 2011
On 15 February 2011 17:32, Kevin Newman <CaptainN at unfocus.com> wrote:
> Hello,
>
> I'm trying to use 'the_post_thumbnail' to output the full size image (the
> original size not resized by wordpress), but without outputting the width
> and height (I'd like them width="100%" height="" actually, but empty would
> be good enough).
>
> Is there anyway to do that with this function, or will I have to build my
> image tag manually?
>
> Kevin N.
the_post_thumbnail() takes an optional second paramter which controls
the <img> tag attributes. Unfortunately the width and height
attributes are applied regardless of this parameter.
Therefore the only way to change the width and height attributes is to
use the 'post_thumbnail_html' filter and do a preg_replace() on the
attributes.
There is a ticket on Trac for this, I'll update this thread when I find it.
John
More information about the wp-hackers
mailing list